Skip to content

regr_test.py: improve interaction between --all and --quiet flags #9349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tests/regr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def test_testcase_directory(package: PackageInfo, version: str, platform: str, q
package_name, test_case_directory = package
is_stdlib = package_name == "stdlib"

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

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

if result.returncode:
if quiet:
# We'll already have printed this if --quiet wasn't passed.
# If--quiet was passed, only print this if there were errors.
# If there are errors, the output is inscrutable if this isn't printed.
print(msg, end=" ")
print_error("failure\n")
replacements = (str(new_test_case_dir), str(test_case_directory))
if result.stderr:
Expand Down