Skip to content

Commit

Permalink
Add windows OS error supressing for temp dir cleanups (#4380) (#4398)
Browse files Browse the repository at this point in the history
Co-authored-by: Ian Knox <[email protected]>
  • Loading branch information
leahwicz and iknox-fa authored Dec 2, 2021
1 parent f8a3c27 commit 4d0d2d0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/integration/015_cli_invocation_tests/test_cli_invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ def temporary_working_directory() -> str:
out : str
The temporary working directory.
"""
with tempfile.TemporaryDirectory() as tmpdir:
with change_working_directory(tmpdir):
yield tmpdir
# N.B: supressing the OSError is necessary for older (pre 3.10) versions of python
# which do not support the `ignore_cleanup_errors` in tempfile::TemporaryDirectory.
# See: https:/python/cpython/pull/24793
#
# In our case the cleanup is redundent since windows handles clearing
# Appdata/Local/Temp at the os level anyway.

with contextlib.suppress(OSError):
with tempfile.TemporaryDirectory() as tmpdir:
with change_working_directory(tmpdir):
yield tmpdir


def get_custom_profiles_config(database_host, custom_schema):
Expand Down

0 comments on commit 4d0d2d0

Please sign in to comment.