File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,16 @@ def pytest_sessionfinish(session: pytest.Session) -> None:
53
53
# copy all pytest own logs inside $VIRTUAL_ENV/log, for collection.
54
54
venv = os .environ .get ("VIRTUAL_ENV" , "" )
55
55
if os .environ .get ("CI" , "0" ) != "0" and venv :
56
- shutil .copytree (
57
- src = session .config ._tmp_path_factory .getbasetemp (), # type: ignore[attr-defined] # noqa: SLF001
58
- dst = venv + "/log" ,
59
- dirs_exist_ok = True ,
60
- )
56
+ # Copy can fail if the source folder was already removed, but we
57
+ # should not fail due to this.
58
+ try :
59
+ shutil .copytree (
60
+ src = session .config ._tmp_path_factory .getbasetemp (), # type: ignore[attr-defined] # noqa: SLF001
61
+ dst = venv + "/log" ,
62
+ dirs_exist_ok = True ,
63
+ )
64
+ except OSError as e :
65
+ _logger .warning ("Failed to copy pytest logs to $VIRTUAL_ENV/log: %s" , e )
61
66
62
67
63
68
@pytest .hookimpl (tryfirst = True ) # type: ignore[misc,unused-ignore]
You can’t perform that action at this time.
0 commit comments