diff --git a/mypy/test/testpep561.py b/mypy/test/testpep561.py index 5d2e3a5963e3..f67b37d6043e 100644 --- a/mypy/test/testpep561.py +++ b/mypy/test/testpep561.py @@ -48,7 +48,10 @@ def install_package(self, pkg: str, try: yield finally: - run_command([python_executable, '-m', 'pip', 'uninstall', '-y', pkg], cwd=package_path) + returncode, lines = run_command([python_executable, '-m', 'pip', 'uninstall', + '-y', pkg], cwd=package_path) + if returncode != 0: + self.fail('\n'.join(lines)) def test_get_pkg_dirs(self) -> None: """Check that get_package_dirs works."""