3 ms·
Django has some different constraints than most projects, and the test suite has been around for a long long time. In most situations pyest is a superior choice
by orf 9y ago
Django has some different constraints than most projects, and the test suite has been around for a long long time. In most situations pyest is a superior choice that goes beyond 'assert' Vs 'self.assert*'.
- sidlls 9y agoHow is pytest superior?
- orf 9y agoIt's much more pythonic for starters, java-style camelcase is not great to look at. Fixtures are very powerful, as are parameterized tests. Assertion failures give you a lot of output to help you debug, like local variables and their values. There are a wide variety of plugins to help you test various frameworks (pytest-django, pytest-asyncio), various other plugins that plug into linters (pytest-flake8, pytest-isort). Super easy parallel tests. If you need to write something that has as few (or no) external dependencies then the standard unittest library is OK. All in all it's a bit like using urllib over requests. Sure, both work and get the job done, but one is just nicer.