Skip to content

Commit

Permalink
fix: another workaround for non-unix platforms especially windows (us…
Browse files Browse the repository at this point in the history
…e pathlib.Path.parts, zip_longest)
  • Loading branch information
ssato committed May 6, 2024
1 parent c5bd507 commit 0c24d69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/common/tdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
r"""Test Data Collecor."""
from __future__ import annotations

import itertools
import os.path
import pathlib
import re
Expand Down Expand Up @@ -47,7 +48,10 @@ def get_test_resdir(
"""
path = pathlib.Path(testfile).resolve()
subdir = pattern.match(path.name).groups()[0]
relpath = str(path.parent).replace(f"{topdir!s}{os.path.sep}", "")
relpath = os.path.join(
*[x for x, y in itertools.zip_longest(path.parent.parts, topdir.parts)
if y is None]
)

return resdir / relpath / subdir

Expand Down

0 comments on commit 0c24d69

Please sign in to comment.