Closed zhaod34 closed 5 months ago
@zhaod34 i'm obtaining the same problem (access denied),
PermissionError: [WinError 5] Accesso negato: 'test-results\test-test-browser-test-user-test-megasearch-test-content-visualization-py-testcontentvisualization-test-content-visualization-with-docuviewer-chromium-pdf\video-1.webm'
that's happening because of xdist,
indeed even if there is the exception,
the folder is deleted,
that means that xdist, spawning different processes, is trying to delete the same files simuntaneally to other xdist processes,
i'm tring to use one of the pytest webhook to empty the folder.
did you found another solution in the meanwhile?
for now i'm using this workaround
def pytest_sessionstart(session):
"""
at the very beginning
"""
print("deleting folder containing video results, if exists")
temptative = 0
while temptative < 3 and os.path.exists('test-results'):
try:
shutil.rmtree('test-results')
except Exception as e:
print("retrying")
time.sleep(1)
temptative =+ 1
print("folder deleted.")
I have the same issue also using xdist. The workaround is rerunning the tests again as the folder is deleted and in the second run you do not see the error. But it wastes a lot of time.
This should be fixed in v0.5.1 which is getting published rn. Thanks to @nck974.
Context
run
pytest -n 3 test_case
Sometimes report the error: