[Answered ]-Django vs Python2.7 unittest TestCase?

2👍

Short answer: use Django TestCase. It does everything that the python unittest.TestCase can do and more.

The python and Django TestCase classes are both for unit tests. The Which should I use section that you link to is comparing unit tests with doc tests.

The Django TestCase is just an extension of the python unittest.TestCase. If you are using an earlier version of Python, then the Django TestCase allows you to use some neat features like assertRaisesExp which are only available in unittest.TestCase for python 2.7.

Since you are using Python 2.7, you don’t need to use the Django TestCase for the Python 2.7 functionality, but there are still lots of extra features, for example fixture loading, which mean you should use the Django TestCase.

Leave a comment