Skip to content

Commit c65f002

Browse files
authored
Merge pull request #24 from utgwkk/windows-support
Windows support
2 parents 1b8a648 + e48f2b6 commit c65f002

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,24 @@ on:
99

1010
jobs:
1111
test:
12-
runs-on: ubuntu-latest
13-
1412
strategy:
1513
matrix:
14+
os: [ubuntu-latest, windows-latest]
1615
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
1716
pytest-version: [4.6.11, 5.4.3]
1817

1918
exclude:
2019
# pytest 5.x.x doesn't support Python 2.7
21-
- python-version: 2.7
20+
- os: ubuntu-latest
21+
python-version: 2.7
2222
pytest-version: 5.4.3
23+
- os: windows-latest
24+
python-version: 2.7
25+
pytest-version: 5.4.3
26+
27+
runs-on: ${{ matrix.os }}
2328

24-
name: Python ${{ matrix.python-version }}, pytest ${{ matrix.pytest-version }}
29+
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, pytest ${{ matrix.pytest-version }}
2530
steps:
2631
- uses: actions/checkout@v2
2732

pytest_github_actions_annotate_failures/plugin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ def pytest_runtest_makereport(item, call):
3535
workspace = os.environ.get("GITHUB_WORKSPACE")
3636
if workspace:
3737
full_path = os.path.abspath(filesystempath)
38-
rel_path = os.path.relpath(full_path, workspace)
38+
try:
39+
rel_path = os.path.relpath(full_path, workspace)
40+
except ValueError:
41+
# os.path.relpath() will raise ValueError on Windows
42+
# when full_path and workspace have different mount points.
43+
# https://github.com/utgwkk/pytest-github-actions-annotate-failures/issues/20
44+
rel_path = filesystempath
3945
if not rel_path.startswith(".."):
4046
filesystempath = rel_path
4147

0 commit comments

Comments
 (0)