Skip to content

Commit 7d4ccc3

Browse files
committed
fix(tests): Adapt pythoneval suite to default to non-pretty output
This commit adapts the `pythoneval` test runner to handle the new pretty-by-default behavior. The `test_python_evaluation` function in `mypy/test/testpythoneval.py` now injects the `--no-pretty` flag by default into the mypy command line it constructs. Logic is also included to respect a `# flags: --pretty` directive, ensuring that tests designed to check pretty-printing still work correctly. Part of #19108.
1 parent e4de3fc commit 7d4ccc3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mypy/test/testpythoneval.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def test_python_evaluation(testcase: DataDrivenTestCase, cache_dir: str) -> None
5454
"--allow-empty-bodies",
5555
"--test-env", # Speeds up some checks
5656
]
57+
58+
mypy_cmdline.append("--no-pretty")
59+
5760
interpreter = python3_path
5861
mypy_cmdline.append(f"--python-version={'.'.join(map(str, PYTHON3_VERSION))}")
5962

@@ -69,6 +72,9 @@ def test_python_evaluation(testcase: DataDrivenTestCase, cache_dir: str) -> None
6972
sys.version_info.minor,
7073
):
7174
return
75+
if '--pretty' in additional_flags:
76+
mypy_cmdline.remove('--no-pretty')
77+
7278
mypy_cmdline.extend(additional_flags)
7379

7480
# Write the program to a file.

0 commit comments

Comments
 (0)