Skip to content

Commit e48f2b6

Browse files
committed
fix: fallback rel_path to filesystempath
1 parent ba39d29 commit e48f2b6

File tree

1 file changed

+7
-1
lines changed
  • pytest_github_actions_annotate_failures

1 file changed

+7
-1
lines changed

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)