Skip to content

Commit 388d783

Browse files
regr_test.py: improve interaction between --all and --quiet flags (#9349)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 1ba0c98 commit 388d783

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/regr_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def test_testcase_directory(package: PackageInfo, version: str, platform: str, q
8989
package_name, test_case_directory = package
9090
is_stdlib = package_name == "stdlib"
9191

92+
msg = f"Running mypy --platform {platform} --python-version {version} on the "
93+
msg += "standard library test cases..." if is_stdlib else f"test cases for {package_name!r}..."
9294
if not quiet:
93-
msg = f"Running mypy --platform {platform} --python-version {version} on the "
94-
msg += "standard library test cases..." if is_stdlib else f"test cases for {package_name!r}..."
9595
print(msg, end=" ")
9696

9797
# "--enable-error-code ignore-without-code" is purposefully ommited. See https://github.com/python/typeshed/pull/8083
@@ -152,6 +152,11 @@ def test_testcase_directory(package: PackageInfo, version: str, platform: str, q
152152
result = subprocess.run([sys.executable, "-m", "mypy", *flags], capture_output=True, env=env_vars)
153153

154154
if result.returncode:
155+
if quiet:
156+
# We'll already have printed this if --quiet wasn't passed.
157+
# If--quiet was passed, only print this if there were errors.
158+
# If there are errors, the output is inscrutable if this isn't printed.
159+
print(msg, end=" ")
155160
print_error("failure\n")
156161
replacements = (str(new_test_case_dir), str(test_case_directory))
157162
if result.stderr:

0 commit comments

Comments
 (0)