Skip to content

Commit 99ea213

Browse files
committed
Add test for wheels with METADATA
1 parent 51c45a6 commit 99ea213

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

WORKSPACE

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,23 @@ http_file(
6666
)
6767

6868
http_file(
69-
name = "futures_whl",
69+
name = "futures_3_1_1_whl",
7070
sha256 = "c4884a65654a7c45435063e14ae85280eb1f111d94e542396717ba9828c4337f",
7171
# From https://pypi.python.org/pypi/futures
7272
url = ("https://pypi.python.org/packages/a6/1c/" +
7373
"72a18c8c7502ee1b38a604a5c5243aa8c2a64f4bba4e6631b1b8972235dd/" +
7474
"futures-3.1.1-py2-none-any.whl"),
7575
)
7676

77+
http_file(
78+
name = "futures_2_2_0_whl",
79+
sha256 = "9fd22b354a4c4755ad8c7d161d93f5026aca4cfe999bd2e53168f14765c02cd6",
80+
# From https://pypi.python.org/pypi/futures/2.2.0
81+
url = ("https://pypi.python.org/packages/d7/1d/" +
82+
"68874943aa37cf1c483fc61def813188473596043158faa6511c04a038b4/" +
83+
"futures-2.2.0-py2.py3-none-any.whl"),
84+
)
85+
7786
http_file(
7887
name = "mock_whl",
7988
sha256 = "5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1",

rules_python/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ py_test(
2626
name = "whl_test",
2727
srcs = ["whl_test.py"],
2828
data = [
29-
"@futures_whl//file",
29+
"@futures_3_1_1_whl//file",
30+
"@futures_2_2_0_whl//file",
3031
"@grpc_whl//file",
3132
"@mock_whl//file",
3233
],

rules_python/whl_test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,23 @@ def test_grpc_whl(self):
3535
self.assertEqual('pypi__grpcio_1_6_0', wheel.repository_name())
3636

3737
def test_futures_whl(self):
38-
td = TestData('futures_whl/file/futures-3.1.1-py2-none-any.whl')
38+
td = TestData('futures_3_1_1_whl/file/futures-3.1.1-py2-none-any.whl')
3939
wheel = whl.Wheel(td)
4040
self.assertEqual(wheel.name(), 'futures')
4141
self.assertEqual(wheel.distribution(), 'futures')
4242
self.assertEqual(wheel.version(), '3.1.1')
4343
self.assertEqual(set(wheel.dependencies()), set())
4444
self.assertEqual('pypi__futures_3_1_1', wheel.repository_name())
4545

46+
def test_whl_with_METADATA_file(self):
47+
td = TestData('futures_2_2_0_whl/file/futures-2.2.0-py2.py3-none-any.whl')
48+
wheel = whl.Wheel(td)
49+
self.assertEqual(wheel.name(), 'futures')
50+
self.assertEqual(wheel.distribution(), 'futures')
51+
self.assertEqual(wheel.version(), '2.2.0')
52+
self.assertEqual(set(wheel.dependencies()), set())
53+
self.assertEqual('pypi__futures_2_2_0', wheel.repository_name())
54+
4655
def test_mock_whl(self):
4756
td = TestData('mock_whl/file/mock-2.0.0-py2.py3-none-any.whl')
4857
wheel = whl.Wheel(td)

0 commit comments

Comments
 (0)