From c2bf585d171a37defceec25f3823b7633787b8c6 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 12 Oct 2021 14:01:52 +0200 Subject: Fix potentially broken shutil.rmtree in tests (#26665) Seems like https://bugs.python.org/issue29699 is relevant. Better to just ignore errors when removing them tmpdir. The OS will remove it anyways. Errors are happening randomly from tests that are using this fixture. --- lib/spack/spack/test/conftest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 17086dbdc0..9a6dc0b13b 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -971,7 +971,10 @@ def mock_gnupghome(monkeypatch): yield short_name_tmpdir # clean up, since we are doing this manually - shutil.rmtree(short_name_tmpdir) + # Ignore errors cause we seem to be hitting a bug similar to + # https://bugs.python.org/issue29699 in CI (FileNotFoundError: [Errno 2] No such + # file or directory: 'S.gpg-agent.extra'). + shutil.rmtree(short_name_tmpdir, ignore_errors=True) ########## # Fake archives and repositories -- cgit v1.2.3-70-g09d2