Ignore errors when cleaning up temp dirs (Win)

This commit is contained in:
Paul Gauthier 2023-07-13 17:18:09 -07:00
parent 8e2b92febb
commit b52a62190a
2 changed files with 20 additions and 4 deletions

15
tests/utils.py Normal file
View file

@ -0,0 +1,15 @@
import tempfile
class IgnorantTemporaryDirectory:
def __init__(self):
self.temp_dir = tempfile.TemporaryDirectory()
def __enter__(self):
return self.temp_dir.__enter__()
def __exit__(self, exc_type, exc_val, exc_tb):
try:
self.temp_dir.__exit__(exc_type, exc_val, exc_tb)
except OSError:
pass # Ignore errors (Windows)