Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3175797

Browse filesBrowse files
authored
Add a simple test that the built and checked in PAR files match. (bazel-contrib#10)
1 parent b28c4c7 commit 3175797
Copy full SHA for 3175797

File tree

Expand file treeCollapse file tree

5 files changed

+58
-1
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+58
-1
lines changed

‎WORKSPACE

Copy file name to clipboardExpand all lines: WORKSPACE
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ _piptool_install()
5252
git_repository(
5353
name = "subpar",
5454
remote = "https://github.com/google/subpar",
55-
tag = "1.1.0",
55+
# HEAD as of 2018/02/15
56+
commit = "1f695ee5d42585a66d9dd9b71219eb8551e59c89",
5657
)
5758

5859
# Test data for WHL tool testing.

‎tools/BUILD

Copy file name to clipboardExpand all lines: tools/BUILD
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ licenses(["notice"]) # Apache 2.0
1717

1818
# This is generated and updated by ./update_tools.sh
1919
exports_files(["piptool.par", "whltool.par"])
20+
21+
py_test(
22+
name = "par_test",
23+
srcs = ["par_test.py"],
24+
data = [
25+
"//rules_python:piptool.par",
26+
"//rules_python:whltool.par",
27+
":piptool.par",
28+
":whltool.par",
29+
],
30+
)

‎tools/par_test.py

Copy file name to clipboard
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2017 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import hashlib
16+
import os
17+
import unittest
18+
19+
20+
def TestData(name):
21+
return os.path.join(os.environ['TEST_SRCDIR'], 'io_bazel_rules_python', name)
22+
23+
24+
class WheelTest(unittest.TestCase):
25+
26+
def test_piptool_matches(self):
27+
with open(TestData('rules_python/piptool.par'), 'r') as f:
28+
built = f.read()
29+
with open(TestData('tools/piptool.par'), 'r') as f:
30+
checked_in = f.read()
31+
self.assertEquals(
32+
hashlib.sha256(built).hexdigest(), hashlib.sha256(checked_in).hexdigest(),
33+
'The checked in tools/piptool.par does not match the latest build.')
34+
35+
def test_whltool_matches(self):
36+
with open(TestData('rules_python/whltool.par'), 'r') as f:
37+
built = f.read()
38+
with open(TestData('tools/whltool.par'), 'r') as f:
39+
checked_in = f.read()
40+
self.assertEquals(
41+
hashlib.sha256(built).hexdigest(), hashlib.sha256(checked_in).hexdigest(),
42+
'The checked in tools/whltool.par does not match the latest build.')
43+
44+
if __name__ == '__main__':
45+
unittest.main()

‎tools/piptool.par

Copy file name to clipboard
3.39 MB
Binary file not shown.

‎tools/whltool.par

Copy file name to clipboard
861 KB
Binary file not shown.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.