DEV Community

Discussion on: Alternate to Nose for Newbie Tester

 
rhymes profile image
rhymes

pytest also allows you to run tests in parallel if you want

Thread Thread
 
grahamlyons profile image
Graham Lyons

I like the xunit style for the test organisation, the well-defined life-cycle (setUp, tearDown (ignoring the un-Pythonic camel-casing)) and the portability.

Yes, you can organise your tests in a module but it's likely you'll have multiple functions and classes in a module and I like to have a corresponding test module with a TestCase class per function/class.

You can use the pytest life-cycle decorators on functions but that then ties you more closely to pytest. Using unittest allows you to switch runners more easily.

I have stopped using the assert* methods on self though - I use plain assert statements which give nicer output from pytest.

Thread Thread
 
rhymes profile image
rhymes

Good compromise :)