Skip to content

Commit 2daa07d

Browse files
authored
stubtest_stdlib: suppress output from pip (#9807)
1 parent 52ec44f commit 2daa07d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/stubtest_stdlib.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,28 @@ def run_stubtest(typeshed_dir: Path) -> int:
2323
combined_allowlist = f"{sys.platform}-py{sys.version_info.major}{sys.version_info.minor}.txt"
2424
with tempfile.TemporaryDirectory() as tmp:
2525
venv_dir = Path(tmp)
26+
print("Setting up an isolated virtual environment...", file=sys.stderr)
2627
try:
2728
pip_exe, python_exe = make_venv(venv_dir)
2829
except Exception:
2930
print_error("fail")
3031
raise
3132

3233
# Install the same mypy version as in "requirements-tests.txt"
33-
subprocess.run([pip_exe, "install", get_mypy_req()], check=True)
34+
try:
35+
install_command = [pip_exe, "install", get_mypy_req()]
36+
subprocess.run(install_command, check=True, text=True, capture_output=True)
37+
except subprocess.CalledProcessError as e:
38+
print(e.stderr, file=sys.stderr)
39+
raise
3440

3541
# Uninstall setuptools from the venv so we can test stdlib's distutils
36-
subprocess.run([pip_exe, "uninstall", "-y", "setuptools"], check=True)
42+
try:
43+
uninstall_command = [pip_exe, "uninstall", "-y", "setuptools"]
44+
subprocess.run(uninstall_command, check=True, text=True, capture_output=True)
45+
except subprocess.CalledProcessError as e:
46+
print(e.stderr, file=sys.stderr)
47+
raise
3748

3849
cmd = [
3950
python_exe,

0 commit comments

Comments
 (0)