Skip to content

Commit

Permalink
Fix path usage on windows
Browse files Browse the repository at this point in the history
The pytest subunit plugin was loading test paths incorrectly on windows
as a posix path. This was causing the test loading to fail unexpectedly
because pytest was unable to process the posix path version of a windows
path. This commit fixes this issue in the pytest plugin.
  • Loading branch information
mtreinish committed Nov 12, 2023
1 parent e3a9e5d commit 21b0efe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stestr/pytest_subunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
from subunit import StreamResultToBytes

Check warning on line 29 in stestr/pytest_subunit.py

View check run for this annotation

Codecov / codecov/patch

stestr/pytest_subunit.py#L26-L29

Added lines #L26 - L29 were not covered by tests


def to_path(testid: str) -> pathlib.PosixPath:
def to_path(testid: str) -> pathlib.Path:
delim = "::"

Check warning on line 33 in stestr/pytest_subunit.py

View check run for this annotation

Codecov / codecov/patch

stestr/pytest_subunit.py#L32-L33

Added lines #L32 - L33 were not covered by tests
if delim in testid:
path = testid.split(delim)[0]

Check warning on line 35 in stestr/pytest_subunit.py

View check run for this annotation

Codecov / codecov/patch

stestr/pytest_subunit.py#L35

Added line #L35 was not covered by tests
else:
path = testid
return pathlib.PosixPath(path).resolve()
return pathlib.Path(path).resolve()

Check warning on line 38 in stestr/pytest_subunit.py

View check run for this annotation

Codecov / codecov/patch

stestr/pytest_subunit.py#L37-L38

Added lines #L37 - L38 were not covered by tests


# hook
Expand Down

0 comments on commit 21b0efe

Please sign in to comment.