Skip to content

Commit

Permalink
Add ignore_cleanup_errors for TemporaryDirectory to supress occasiona…
Browse files Browse the repository at this point in the history
…l errors on Windows
  • Loading branch information
mlech-reef committed Nov 27, 2024
1 parent bf4b165 commit 5d74b59
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,14 @@ def auto_change_account_info_dir(monkeysession) -> str:
monkeysession.delenv('B2_APPLICATION_KEY_ID', raising=False)
monkeysession.delenv('B2_APPLICATION_KEY', raising=False)

# Ignore occasional PermissionError on Windows
if sys.platform == 'win32' and (sys.version_info.major, sys.version_info.minor) > (3, 9):
kwargs = dict(ignore_cleanup_errors=True)
else:
kwargs = {}

# make b2sdk use temp dir for storing default & per-profile account information
with TemporaryDirectory() as temp_dir:
with TemporaryDirectory(**kwargs) as temp_dir:
monkeysession.setenv(B2_ACCOUNT_INFO_ENV_VAR, path.join(temp_dir, '.b2_account_info'))
monkeysession.setenv(XDG_CONFIG_HOME_ENV_VAR, temp_dir)
yield temp_dir
Expand Down

0 comments on commit 5d74b59

Please sign in to comment.