From 7517a2f87e5e8d0cfad42dbc84f1ad2e066f920f Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Mon, 10 Jan 2022 10:09:46 -0500 Subject: [PATCH] Do some test cleanup (#952) Do some test cleanup We have been seeing some random test failures due to No space left on device errors. Not entirely sure what is causing that, but this is at least a start. This will remove the copy of the test project tree that is made for every test that uses the project_fixtures fixture. Also, remove a now unused pytest fixture (clear_integration_artifacts). Also fix a flaky test (test_stdout_file_no_write) that fails randomly under pexpect preventing this from merging. The assert's being removed are not actually testing the feature. Reviewed-by: Alan Rominger Reviewed-by: Alexander Sowitzki Reviewed-by: None (cherry picked from commit 0e451fca0c336dabe28179e4c01d5df803e37f1d) --- 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)