I have created several tests which create different files and folders in the test folder. I want to delete all the folders that have been created through the tests, but only at the end of the test execution. I have written this fixture:
import shutil
@fixture(scope='session',autouse=True)
def delete_files():
yield None
shutil.rmtree('test-folder')
But somehow this does not execute last, after all the tests have passed. How to solve this and to delete all the test folders at the end of test execution?