Run code before and after each test in py.test?
py.test fixtures are a technically adequate method to achieve your purpose. You just need to define a fixture like that: @pytest.fixture(autouse=True) def run_around_tests(): # Code that will run before your test, for example: files_before = # … do something to check the existing files # A test function will be run at this point yield … Read more