From 3f5eb8a0ab244f8b6bf20e8c9963b61d438b9736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Wed, 2 Aug 2023 13:49:12 +0200 Subject: [PATCH] Remove the test directory after successful test run --- tests/test_bitrot.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_bitrot.py b/tests/test_bitrot.py index 35abb5c..73f0dc4 100644 --- a/tests/test_bitrot.py +++ b/tests/test_bitrot.py @@ -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)