you can write tests as functions (you can also use methods in classes like in unittest)
the conftest.py mechanism allows you to group setups that are evaluated only at necessity in a cascading fashion in sub folders
the test function explicitly declares what mocks it needs to run
fixtures make a great way to organize tests that need a complex setup and tests that can run super fast and have initializers that can be run per session, per test, per file/module
there are no custom assertion methods (you use mostly assert and with)
it's unittest compatible
it has lots of plugins
the cons are:
it requires a little bit of time to understand how fixtures work
I prefer pytest over unittest. The pros are:
conftest.py
mechanism allows you to group setups that are evaluated only at necessity in a cascading fashion in sub foldersassert
andwith
)the cons are:
Thank you for your very valuable opinion!
This is exactly what I was looking for.
The disadvantages seemed to be fine for me,
I would like to verify using pytest.
I agree with everything here, except I actually found pytest fixtures to be pretty intuitive.