Skip to content

Commit

Permalink
[mypyc] Fix command-line tests on Python 3.11 (#13867)
Browse files Browse the repository at this point in the history
This fixes the testErrorOutput and testCompileMypyc test cases by
setting up the module search path explicitly.
  • Loading branch information
JukkaL authored Oct 11, 2022
1 parent 628a511 commit 447ed2b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mypyc/test/test_commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
with open(program_path, "w") as f:
f.write(text)

env = os.environ.copy()
env["PYTHONPATH"] = base_path

out = b""
try:
# Compile program
Expand All @@ -51,6 +54,7 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd="tmp",
env=env,
)
if "ErrorOutput" in testcase.name or cmd.returncode != 0:
out += cmd.stdout
Expand Down

0 comments on commit 447ed2b

Please sign in to comment.