Add test for 'pip check' with broken metadata
@@ -222,3 +222,19 @@ def test_check_development_versions_are_also_considered(script):
)
assert matches_expected_lines(result.stdout, expected_lines)
assert result.returncode == 0
+
+def test_basic_check_broken_metadata(script):
+ # Create some corrupt metadata
+ dist_info_dir = script.site_packages_path / 'pkga-1.0.dist-info'
+ dist_info_dir.mkdir()
+ with open(dist_info_dir / 'METADATA', 'w') as f:
+ f.write('Metadata-Version: 2.1\n'
+ 'Name: pkga\n'
+ 'Version: 1.0\n'
+ 'Requires-Dist: requests; python_version == "3.4"; extra == "test"\n'
+ )
+
+ result = script.pip('check', expect_error=True)
+
+ assert 'Error parsing requirements' in result.stderr
+ assert result.returncode == 1
