File tree 3 files changed +27
-3
lines changed
3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -101,10 +101,8 @@ jobs:
101
101
- name : Archive logs
102
102
uses : actions/upload-artifact@v4
103
103
with :
104
- name : logs.zip
104
+ name : logs-${{ matrix.name }} .zip
105
105
path : .tox/**/log/
106
- # https://github.com/actions/upload-artifact/issues/123
107
- continue-on-error : true
108
106
109
107
- name : Report failure if git reports dirty status
110
108
run : |
Original file line number Diff line number Diff line change @@ -47,6 +47,21 @@ You can disable regex check by defining `PYTEST_CHECK_TEST_ID_REGEX=0`.
47
47
48
48
You can disable the length check by defining ` PYTEST_MAX_TEST_ID_LENGTH=0 ` .
49
49
50
+ ## Prepare pytest log files for collection on CI
51
+
52
+ As pytest log files are created on temp directory and some CI systems refuse
53
+ to collect files from outside the current project, we do copy these files inside
54
+ ` $VIRTUAL_ENV/log ` , same directory used by tox itself. To collect the logs on
55
+ Github Actions, you only need a step like:
56
+
57
+ ``` yaml
58
+ - name : Archive logs
59
+ uses : actions/upload-artifact@v4
60
+ with :
61
+ name : logs-${{ matrix.name }}.zip
62
+ path : .tox/**/log/
63
+ ` ` `
64
+
50
65
## Release process
51
66
52
67
Releases are triggered from [GitHub Releases](https://github.com/pytest-dev/pytest-plus/releases)
Original file line number Diff line number Diff line change 3
3
4
4
import os
5
5
import re
6
+ import shutil
6
7
7
8
import pytest
8
9
from _pytest .terminal import TerminalReporter
@@ -45,6 +46,16 @@ def pytest_sessionfinish(session: pytest.Session) -> None:
45
46
)
46
47
session .exitstatus = 1
47
48
49
+ # If running under CI (Github Actions included) and inside a venv, do
50
+ # copy all pytest own logs inside $VIRTUAL_ENV/log, for collection.
51
+ venv = os .environ .get ("VIRTUAL_ENV" , "" )
52
+ if os .environ .get ("CI" , "0" ) != "0" and venv :
53
+ shutil .copytree (
54
+ src = session .config ._tmp_path_factory .getbasetemp (), # type: ignore[attr-defined] # noqa: SLF001
55
+ dst = venv + "/log" ,
56
+ dirs_exist_ok = True ,
57
+ )
58
+
48
59
49
60
@pytest .hookimpl (tryfirst = True ) # type: ignore[misc,unused-ignore]
50
61
def pytest_collection_modifyitems (items : list [pytest .Item ]) -> None :
You can’t perform that action at this time.
0 commit comments