From ae743191290496e272835819c4c2f70916f0606a Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Mon, 31 Jan 2022 08:12:12 -0500 Subject: [PATCH] Do some test cleanup (#952) (#980) [backport][release_2.0] Do some test cleanup (#952) Backport of PR #952 (cherry picked from commit 0e451fc) Reviewed-by: Alexander Sowitzki Reviewed-by: None --- test/integration/conftest.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/test/integration/conftest.py b/test/integration/conftest.py index 0d93bfdc5..6a3660d5b 100644 --- a/test/integration/conftest.py +++ b/test/integration/conftest.py @@ -29,24 +29,6 @@ def rc(tmp_path): return rc -@pytest.fixture(scope='session') -def clear_integration_artifacts(request): - '''Fixture is session scoped to allow parallel runs without error - ''' - if 'PYTEST_XDIST_WORKER' in os.environ: - # we never want to clean artifacts if running parallel tests - # because we cannot know when all processes are finished and it is - # safe to clean up - return - - def rm_integration_artifacts(): - path = "test/integration/artifacts" - if os.path.exists(path): - shutil.rmtree(path) - - request.addfinalizer(rm_integration_artifacts) - - class CompletedProcessProxy(object): def __init__(self, result): @@ -106,4 +88,6 @@ def project_fixtures(tmp_path): dest = tmp_path / 'projects' shutil.copytree(source, dest) - return dest + yield dest + + shutil.rmtree(dest, ignore_errors=True)