Add test for wheels with METADATA
diff --git a/WORKSPACE b/WORKSPACE index d62ea20..2f6894b 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -66,7 +66,7 @@ ) http_file( - name = "futures_whl", + name = "futures_3_1_1_whl", sha256 = "c4884a65654a7c45435063e14ae85280eb1f111d94e542396717ba9828c4337f", # From https://pypi.python.org/pypi/futures url = ("https://pypi.python.org/packages/a6/1c/" + @@ -75,6 +75,15 @@ ) http_file( + name = "futures_2_2_0_whl", + sha256 = "9fd22b354a4c4755ad8c7d161d93f5026aca4cfe999bd2e53168f14765c02cd6", + # From https://pypi.python.org/pypi/futures/2.2.0 + url = ("https://pypi.python.org/packages/d7/1d/" + + "68874943aa37cf1c483fc61def813188473596043158faa6511c04a038b4/" + + "futures-2.2.0-py2.py3-none-any.whl"), +) + +http_file( name = "mock_whl", sha256 = "5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1", # From https://pypi.python.org/pypi/mock
diff --git a/rules_python/BUILD b/rules_python/BUILD index d9e72e2..08aca7e 100644 --- a/rules_python/BUILD +++ b/rules_python/BUILD
@@ -26,7 +26,8 @@ name = "whl_test", srcs = ["whl_test.py"], data = [ - "@futures_whl//file", + "@futures_3_1_1_whl//file", + "@futures_2_2_0_whl//file", "@grpc_whl//file", "@mock_whl//file", ],
diff --git a/rules_python/whl_test.py b/rules_python/whl_test.py index 1b06821..e148328 100644 --- a/rules_python/whl_test.py +++ b/rules_python/whl_test.py
@@ -35,7 +35,7 @@ self.assertEqual('pypi__grpcio_1_6_0', wheel.repository_name()) def test_futures_whl(self): - td = TestData('futures_whl/file/futures-3.1.1-py2-none-any.whl') + td = TestData('futures_3_1_1_whl/file/futures-3.1.1-py2-none-any.whl') wheel = whl.Wheel(td) self.assertEqual(wheel.name(), 'futures') self.assertEqual(wheel.distribution(), 'futures') @@ -43,6 +43,15 @@ self.assertEqual(set(wheel.dependencies()), set()) self.assertEqual('pypi__futures_3_1_1', wheel.repository_name()) + def test_whl_with_METADATA_file(self): + td = TestData('futures_2_2_0_whl/file/futures-2.2.0-py2.py3-none-any.whl') + wheel = whl.Wheel(td) + self.assertEqual(wheel.name(), 'futures') + self.assertEqual(wheel.distribution(), 'futures') + self.assertEqual(wheel.version(), '2.2.0') + self.assertEqual(set(wheel.dependencies()), set()) + self.assertEqual('pypi__futures_2_2_0', wheel.repository_name()) + def test_mock_whl(self): td = TestData('mock_whl/file/mock-2.0.0-py2.py3-none-any.whl') wheel = whl.Wheel(td)