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.
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 onself
though - I use plainassert
statements which give nicer output from pytest.Good compromise :)