Skip to content

Commit

Permalink
Do some test cleanup (ansible#952)
Browse files Browse the repository at this point in the history
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 <arominge@redhat.com>
Reviewed-by: Alexander Sowitzki <dev@eqrx.net>
Reviewed-by: None <None>
(cherry picked from commit 0e451fc)
  • Loading branch information
Shrews committed Jan 27, 2022
1 parent ebc432a commit 7517a2f
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions test/integration/conftest.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

0 comments on commit 7517a2f

Please sign in to comment.