Remove the test directory after successful test run

This commit is contained in:
Łukasz Langa 2023-08-02 13:49:12 +02:00
parent 955b370815
commit 3f5eb8a0ab
No known key found for this signature in database
GPG Key ID: B26995E310250568

View File

@ -337,3 +337,12 @@ def test_rotten_file_2() -> None:
)
assert err[0].startswith(e)
assert err[1] == "error: There were 1 errors found."
@pytest.mark.order("last")
def test_cleanup() -> None:
username = getpass.getuser()
test_dir = TMP / f"bitrot-dir-{username}"
if test_dir.is_dir():
os.chdir(TMP)
shutil.rmtree(test_dir)