Pytest documentation describes four ways to setup/teardown things:
- module level setup/teardown
- class level setup/teardown
- method level setup/teardown
- function level setup/teardown
But in one project it was implemented like this:
class TestClass:
def setup(self):
...
def test_1(self):
...
...
This setup method is called around each method invocation, just like setup_method from documentation (except that it doesn't take method as an argument). But I haven't seen it in the documentation or anywhere else. Why does it work?
Aucun commentaire:
Enregistrer un commentaire