def test_wheel_metadata_fails_missing_wheel(tmpdir, zip_dir): dist_info_dir = tmpdir / "simple-0.1.0.dist-info" dist_info_dir.mkdir() dist_info_dir.joinpath("METADATA").touch() with pytest.raises(UnsupportedWheel) as e: wheel.wheel_metadata(zip_dir(tmpdir), dist_info_dir.name) assert "could not read" in str(e.value)
def test_wheel_metadata_fails_on_bad_encoding(tmpdir, zip_dir): dist_info_dir = tmpdir / "simple-0.1.0.dist-info" dist_info_dir.mkdir() dist_info_dir.joinpath("METADATA").touch() dist_info_dir.joinpath("WHEEL").write_bytes(b"\xff") with pytest.raises(UnsupportedWheel) as e: wheel.wheel_metadata(zip_dir(tmpdir), dist_info_dir.name) assert "error decoding" in str(e.value)