Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use best-effort artifacts folder removal #191

Merged
merged 3 commits into from
Oct 10, 2023
Merged

Conversation

mxschmitt
Copy link
Member

Fixes #163

pytest_playwright/pytest_playwright.py Outdated Show resolved Hide resolved
except (PermissionError, NotADirectoryError):
for file in os.listdir(artifacts_folder.name):
try:
os.remove(os.path.join(artifacts_folder.name, file))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we have a sub-directory there? Shouldn't this be rmtree? Alternatively, we can:

  • ignore the error and not cleanup;
  • retry artifacts_folder.cleanup() after a timeout;
  • implement smart recursive retrying like rimraf.

@mxschmitt mxschmitt merged commit ef99541 into main Oct 10, 2023
17 checks passed
@mxschmitt mxschmitt deleted the bugfix/cleanup branch October 10, 2023 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

artifacts_folder.cleanup() raises PermissionError: [WinError 32]
2 participants