From 03d5fc27d177805310b1388bcba0bacaba541a8f Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Sat, 20 Jul 2024 00:54:19 -0400 Subject: [PATCH] test: Cleanup directories conditionally --- integration_tests/test_webservice.py | 2 +- tests/conftest.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/integration_tests/test_webservice.py b/integration_tests/test_webservice.py index 28da2ba8..888bcf4d 100644 --- a/integration_tests/test_webservice.py +++ b/integration_tests/test_webservice.py @@ -7,7 +7,7 @@ from integration_tests import req BASEDIR = os.path.realpath(".").replace("\\", "\\\\") -with (Path(__file__).absolute().parent.parent / "tests" / "quotesbot.egg").open("rb") as f: +with (Path(__file__).absolute().parent.parent / "tests" / "fixtures" / "quotesbot.egg").open("rb") as f: EGG = f.read() diff --git a/tests/conftest.py b/tests/conftest.py index de367159..0207e07c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,7 +34,8 @@ def root(request): basedir = os.path.realpath(os.path.dirname(os.path.dirname(__file__))) # Avoid accidentally deleting directories outside the project. assert os.path.commonprefix((directory, basedir)) == basedir - shutil.rmtree(directory) + if os.path.exists(directory): + shutil.rmtree(directory) @pytest.fixture()