For !966 (merged) I had to spend hours debugging issues in our test code which ultimately turned out to be a bug in pytest-django. This was a frustrating experience that made me wonder why we use pytest in the first place. Apart from the bugs, the added complexity just makes it harder to debug.
Some pytest features that come to mind:
- fixtures are injected automagically
- parametrize is neat
- it is not required to wrap tests in classes
assertinstead of custom functions
None of these seem essential to me, and if you like these or not is a matter of personal taste. I for one think there is to much implicit/magic stuff in there.
How would a migration work?
As far as I know, pytest is compatible with standard unittests. So we can port the tests on by one while still using pytest to run them. Once everything is ported we can switch the test runner. We could still use model_mommy to create test data. But instead of injecting fixtures, we would need to explicitly create test data every time. It probably makes sense to create some helpers for that under
I am very open to change my mind if it turns out this isn't feasible. But I think it is worth a try.
Maybe it is sufficient to remove pytest-django but keep using pytest. This would remove much of the current issues, while still allowing us to use fixtures as before. Not sure if this works as I expect though.