Skip to content

Commit 0c3ffd4

Browse files
authored
lib-rt tests: discover lib-rt source more flexibly (#21034)
When running the tests as part of Debian packaging, the current working directory will not be the root of the unpacked mypy sdist/archive, therefore searching parent directories will fail. Use the `PREFIX` variable from `mypyc.test.config`, which will reflect the value of the `MYPY_TEST_PREFIX` enviornment variable.
1 parent c73021f commit 0c3ffd4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

mypyc/test/test_external.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
from mypyc.build import get_cflags, include_dir
1414

15-
base_dir = os.path.join(os.path.dirname(__file__), "..", "..")
15+
from .config import PREFIX
16+
1617
EXCLUDED_LIB_RT_COMPILE_FILES = ["static_data.c"]
1718

1819

@@ -88,7 +89,7 @@ def test_c_unit_test(self) -> None:
8889
"--run-capi-tests",
8990
],
9091
env=env,
91-
cwd=os.path.join(base_dir, "mypyc", "lib-rt"),
92+
cwd=os.path.join(PREFIX, "mypyc", "lib-rt"),
9293
)
9394
# Run C unit tests.
9495
env = os.environ.copy()

0 commit comments

Comments
 (0)