Skip to content

Commit 447ed2b

Browse files
authored
[mypyc] Fix command-line tests on Python 3.11 (#13867)
This fixes the testErrorOutput and testCompileMypyc test cases by setting up the module search path explicitly.
1 parent 628a511 commit 447ed2b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mypyc/test/test_commandline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
4343
with open(program_path, "w") as f:
4444
f.write(text)
4545

46+
env = os.environ.copy()
47+
env["PYTHONPATH"] = base_path
48+
4649
out = b""
4750
try:
4851
# Compile program
@@ -51,6 +54,7 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
5154
stdout=subprocess.PIPE,
5255
stderr=subprocess.STDOUT,
5356
cwd="tmp",
57+
env=env,
5458
)
5559
if "ErrorOutput" in testcase.name or cmd.returncode != 0:
5660
out += cmd.stdout

0 commit comments

Comments
 (0)