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.
This commit is contained in:
Harmen Stoppels 2021-10-12 14:01:52 +02:00 committed by GitHub
parent 66b32b337f
commit c2bf585d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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