Unless you are a huge nosetest fan, I'd suggest to switch the test suite to pytest. I'm pretty sure you are already familiar with pytest @wojcikstefan but if not, or if you need me to elaborate on why it's better, just let me know :)
Thanks for opening an issue about this @bagerard. I'm definitely in favor of switching our test suite to pytest :)
Next steps:
test_ prefix in their name and hence are automatically discovered by pytest. However, there are some exceptions that we'd need to fix (e.g. tests/queryset/queryset.py would have to be renamed to tests/queryset/test_queryset.py).tests/*.py files and then we could drop the test_ prefix altogether. I've worked with codebases using this convention and I'm quite fond of it actually – it's nice when testing of lib_name/x/y/z.py is done in tests/x/y/z.py (as in, tests mirror the structure of the code exactly). The drawback here is that test-specific utility files might be harder to discern from files containing actual tests. That said, in practice I've noticed that it doesn't matter much since you typically only have the standard conftests.py and fixtures.py (or a fixtures/*.py dir).pytest and change tox.ini to use pytest instead of python setup.py nosetests.asserts, etc.Does that make sense @bagerard? Do you have a preference wrt the naming convention of test files? Am I missing anything?
THanks for your feedback @wojcikstefan, glad to hear that you like it as well. Personally I prefer to use the "test_{original_filename}.py" convention for test files (being the default of pytest), I like that it makes test files easier to find in IDE but it doesn't matter much at the end, just tell me which way you want to go.
regarding 3) the pytest guys actually provide unittest2pytest that ease the migration (smart move from them)
I agree that in terms of planning, we should decouple:
I like that it makes test files easier to find in IDE
That's a valid point. Given that a) this is the pytest default, b) most of our test suite already conforms to this convention, c) it helps with file navigation in some IDEs, I'm happy to go the test_{original_filename}.py route 👍
I'd try to do this is in 1 shot
SGTM. Wanna give it a try or should I?
Leave that with me, I should have some time to work on this in the next weeks
I'm working on this right now, I struggled with getting it working with 2to3 + tox but its moving forward, almost there
Current status:
nose to pytest and plug coverage (#2157)@bagerard you may have luck with https://github.com/pytest-dev/unittest2pytest for your third TODO
Yep, thanks I actually already started reworking the assertions and that lib was amazing, worked like a charm :)
Closing this as the switch was done recently
Most helpful comment
Leave that with me, I should have some time to work on this in the next weeks