Merge ~jslarraz/review-tools:run-black into review-tools:master
- Git
- lp:~jslarraz/review-tools
- run-black
- Merge into master
Proposed by
Jorge Sancho Larraz
Status: | Merged |
---|---|
Merged at revision: | d438d79718c3412236809685c25bdb086472b426 |
Proposed branch: | ~jslarraz/review-tools:run-black |
Merge into: | review-tools:master |
Diff against target: |
380 lines (+69/-37) 13 files modified
reviewtools/modules.py (+1/-0) reviewtools/overrides.py (+1/-1) reviewtools/sr_common.py (+5/-3) reviewtools/sr_functional.py (+1/-1) reviewtools/sr_lint.py (+2/-1) reviewtools/sr_security.py (+9/-5) reviewtools/tests/test_debversion.py (+1/-1) reviewtools/tests/test_email.py (+2/-2) reviewtools/tests/test_sr_declaration.py (+0/-3) reviewtools/tests/test_sr_functional.py (+4/-4) reviewtools/tests/test_sr_lint.py (+26/-10) reviewtools/tests/test_sr_security.py (+1/-1) reviewtools/tests/test_store.py (+16/-5) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alex Murray | Approve | ||
Review via email:
|
Commit message
As discussed we want to start enforcing black format in review-tools. This PR should only include format changes to adopt meet black format.
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/reviewtools/modules.py b/reviewtools/modules.py | |||
2 | index bd8be66..9b93f32 100644 | |||
3 | --- a/reviewtools/modules.py | |||
4 | +++ b/reviewtools/modules.py | |||
5 | @@ -56,6 +56,7 @@ def find_main_class(module_name): | |||
6 | 56 | fullpath = "%s/%s.py" % (dir, module_name) | 56 | fullpath = "%s/%s.py" % (dir, module_name) |
7 | 57 | if os.path.isfile(fullpath): | 57 | if os.path.isfile(fullpath): |
8 | 58 | import importlib.util | 58 | import importlib.util |
9 | 59 | |||
10 | 59 | spec = importlib.util.spec_from_file_location(module_name, fullpath) | 60 | spec = importlib.util.spec_from_file_location(module_name, fullpath) |
11 | 60 | if spec is None or spec.loader is None: | 61 | if spec is None or spec.loader is None: |
12 | 61 | continue | 62 | continue |
13 | diff --git a/reviewtools/overrides.py b/reviewtools/overrides.py | |||
14 | index a1db622..60d833b 100644 | |||
15 | --- a/reviewtools/overrides.py | |||
16 | +++ b/reviewtools/overrides.py | |||
17 | @@ -1271,7 +1271,7 @@ canonical_security = [ | |||
18 | 1271 | "jorge.sancho.larraz@canonical.com", | 1271 | "jorge.sancho.larraz@canonical.com", |
19 | 1272 | "leo.barbosa@canonical.com", | 1272 | "leo.barbosa@canonical.com", |
20 | 1273 | "nishit.majithia@canonical.com", | 1273 | "nishit.majithia@canonical.com", |
22 | 1274 | "paulo.smorigo@canonical.com" | 1274 | "paulo.smorigo@canonical.com", |
23 | 1275 | ] | 1275 | ] |
24 | 1276 | 1276 | ||
25 | 1277 | canonical_server = ["christian.ehrhardt@canonical.com", "robie.basak@canonical.com"] | 1277 | canonical_server = ["christian.ehrhardt@canonical.com", "robie.basak@canonical.com"] |
26 | diff --git a/reviewtools/sr_common.py b/reviewtools/sr_common.py | |||
27 | index 4d33459..201a0dc 100644 | |||
28 | --- a/reviewtools/sr_common.py | |||
29 | +++ b/reviewtools/sr_common.py | |||
30 | @@ -286,9 +286,11 @@ class SnapReview(Review): | |||
31 | 286 | "posix-mq/plugs": "", | 286 | "posix-mq/plugs": "", |
32 | 287 | }, | 287 | }, |
33 | 288 | "pwm": {"chip-number/slots": 0, "channel/slots": 0}, | 288 | "pwm": {"chip-number/slots": 0, "channel/slots": 0}, |
37 | 289 | "qualcomm-ipc-router": {"address/slots": "", | 289 | "qualcomm-ipc-router": { |
38 | 290 | "qcipc/plugs": "", | 290 | "address/slots": "", |
39 | 291 | "qcipc/slots": ""}, | 291 | "qcipc/plugs": "", |
40 | 292 | "qcipc/slots": "", | ||
41 | 293 | }, | ||
42 | 292 | "raw-volume": {"path/slots": ""}, | 294 | "raw-volume": {"path/slots": ""}, |
43 | 293 | "sd-control": {"flavor/plugs": ""}, | 295 | "sd-control": {"flavor/plugs": ""}, |
44 | 294 | "serial-port": { | 296 | "serial-port": { |
45 | diff --git a/reviewtools/sr_functional.py b/reviewtools/sr_functional.py | |||
46 | index 6ec2300..bbdc56b 100644 | |||
47 | --- a/reviewtools/sr_functional.py | |||
48 | +++ b/reviewtools/sr_functional.py | |||
49 | @@ -62,7 +62,7 @@ class SnapReviewFunctional(SnapReview): | |||
50 | 62 | 62 | ||
51 | 63 | # read in current state | 63 | # read in current state |
52 | 64 | self.curr_state = {} | 64 | self.curr_state = {} |
54 | 65 | for (line, item) in self.unsquashfs_lln_entries: | 65 | for line, item in self.unsquashfs_lln_entries: |
55 | 66 | if item is None: | 66 | if item is None: |
56 | 67 | continue | 67 | continue |
57 | 68 | 68 | ||
58 | diff --git a/reviewtools/sr_lint.py b/reviewtools/sr_lint.py | |||
59 | index d8cdca4..c94340a 100644 | |||
60 | --- a/reviewtools/sr_lint.py | |||
61 | +++ b/reviewtools/sr_lint.py | |||
62 | @@ -3295,7 +3295,8 @@ class SnapReviewLint(SnapReview): | |||
63 | 3295 | def check_mpris_slot_name(self): | 3295 | def check_mpris_slot_name(self): |
64 | 3296 | """Check mpris slot name attribute is valid | 3296 | """Check mpris slot name attribute is valid |
65 | 3297 | 3297 | ||
67 | 3298 | https://github.com/snapcore/snapd/blob/55909123bcf261d11c9714b9245e9307f64f6891/interfaces/builtin/mpris.go#L215""" | 3298 | https://github.com/snapcore/snapd/blob/55909123bcf261d11c9714b9245e9307f64f6891/interfaces/builtin/mpris.go#L215 |
68 | 3299 | """ | ||
69 | 3299 | if "slots" not in self.snap_yaml: | 3300 | if "slots" not in self.snap_yaml: |
70 | 3300 | return | 3301 | return |
71 | 3301 | 3302 | ||
72 | diff --git a/reviewtools/sr_security.py b/reviewtools/sr_security.py | |||
73 | index 27f2ea8..5353208 100644 | |||
74 | --- a/reviewtools/sr_security.py | |||
75 | +++ b/reviewtools/sr_security.py | |||
76 | @@ -179,7 +179,10 @@ class SnapReviewSecurity(SnapReview): | |||
77 | 179 | 179 | ||
78 | 180 | orig_stat = os.stat(orig) | 180 | orig_stat = os.stat(orig) |
79 | 181 | resq_stat = os.stat(resq) | 181 | resq_stat = os.stat(resq) |
81 | 182 | debug_output += "\norig size: %d\nresq_size: %d" % (orig_stat.st_size, resq_stat.st_size) | 182 | debug_output += "\norig size: %d\nresq_size: %d" % ( |
82 | 183 | orig_stat.st_size, | ||
83 | 184 | resq_stat.st_size, | ||
84 | 185 | ) | ||
85 | 183 | 186 | ||
86 | 184 | return debug_output | 187 | return debug_output |
87 | 185 | 188 | ||
88 | @@ -376,8 +379,9 @@ class SnapReviewSecurity(SnapReview): | |||
89 | 376 | # If repacked package is smaller then original one, that means it's | 379 | # If repacked package is smaller then original one, that means it's |
90 | 377 | # truncated with the minimum size. | 380 | # truncated with the minimum size. |
91 | 378 | if os.stat(fn).st_size == SNAP_MINIMUM_SIZE and ( | 381 | if os.stat(fn).st_size == SNAP_MINIMUM_SIZE and ( |
94 | 379 | os.stat(tmp_repack).st_size < os.stat(fn).st_size): | 382 | os.stat(tmp_repack).st_size < os.stat(fn).st_size |
95 | 380 | with open(tmp_repack, 'ab') as f: | 383 | ): |
96 | 384 | with open(tmp_repack, "ab") as f: | ||
97 | 381 | f.truncate(SNAP_MINIMUM_SIZE) | 385 | f.truncate(SNAP_MINIMUM_SIZE) |
98 | 382 | 386 | ||
99 | 383 | (rc, out) = cmd(["sha512sum", tmp_repack]) | 387 | (rc, out) = cmd(["sha512sum", tmp_repack]) |
100 | @@ -537,7 +541,7 @@ class SnapReviewSecurity(SnapReview): | |||
101 | 537 | readdir_pat = re.compile(r"^r.xr.xr.x") | 541 | readdir_pat = re.compile(r"^r.xr.xr.x") |
102 | 538 | errors = [] | 542 | errors = [] |
103 | 539 | 543 | ||
105 | 540 | for (line, item) in self.unsquashfs_lln_entries: | 544 | for line, item in self.unsquashfs_lln_entries: |
106 | 541 | if item is None: | 545 | if item is None: |
107 | 542 | continue | 546 | continue |
108 | 543 | 547 | ||
109 | @@ -621,7 +625,7 @@ class SnapReviewSecurity(SnapReview): | |||
110 | 621 | if ref in self.base_declaration["slots"]: | 625 | if ref in self.base_declaration["slots"]: |
111 | 622 | ok = False | 626 | ok = False |
112 | 623 | if pkgname in sec_iface_ref_matches_base_decl_overrides: | 627 | if pkgname in sec_iface_ref_matches_base_decl_overrides: |
114 | 624 | for (aIface, aRef) in sec_iface_ref_matches_base_decl_overrides[ | 628 | for aIface, aRef in sec_iface_ref_matches_base_decl_overrides[ |
115 | 625 | pkgname | 629 | pkgname |
116 | 626 | ]: | 630 | ]: |
117 | 627 | if ( | 631 | if ( |
118 | diff --git a/reviewtools/tests/test_debversion.py b/reviewtools/tests/test_debversion.py | |||
119 | index 406c72e..f5190ec 100644 | |||
120 | --- a/reviewtools/tests/test_debversion.py | |||
121 | +++ b/reviewtools/tests/test_debversion.py | |||
122 | @@ -81,7 +81,7 @@ class TestDebVersion(TestCase): | |||
123 | 81 | ), | 81 | ), |
124 | 82 | ] | 82 | ] |
125 | 83 | print("") | 83 | print("") |
127 | 84 | for (av, bv, expected) in versions: | 84 | for av, bv, expected in versions: |
128 | 85 | print(" checking compare(%s, %s) == %d" % (av, bv, expected)) | 85 | print(" checking compare(%s, %s) == %d" % (av, bv, expected)) |
129 | 86 | a = DebVersion(av) | 86 | a = DebVersion(av) |
130 | 87 | b = DebVersion(bv) | 87 | b = DebVersion(bv) |
131 | diff --git a/reviewtools/tests/test_email.py b/reviewtools/tests/test_email.py | |||
132 | index f665bc5..fa2e30f 100644 | |||
133 | --- a/reviewtools/tests/test_email.py | |||
134 | +++ b/reviewtools/tests/test_email.py | |||
135 | @@ -28,7 +28,7 @@ class TestEmail(TestCase): | |||
136 | 28 | ("Foo Bar <foo.bar@example.com>", "foo.bar@example.com"), | 28 | ("Foo Bar <foo.bar@example.com>", "foo.bar@example.com"), |
137 | 29 | ("snaps@canonical.com", "snaps@canonical.com"), | 29 | ("snaps@canonical.com", "snaps@canonical.com"), |
138 | 30 | ] | 30 | ] |
140 | 31 | for (addr, expected) in addresses: | 31 | for addr, expected in addresses: |
141 | 32 | self.assertEqual(sanitize_addr(addr), expected) | 32 | self.assertEqual(sanitize_addr(addr), expected) |
142 | 33 | 33 | ||
143 | 34 | def test_check_sanitize_addr_invalid(self): | 34 | def test_check_sanitize_addr_invalid(self): |
144 | @@ -40,5 +40,5 @@ class TestEmail(TestCase): | |||
145 | 40 | ("@foo.bar", ""), | 40 | ("@foo.bar", ""), |
146 | 41 | ("foo@@bar", ""), | 41 | ("foo@@bar", ""), |
147 | 42 | ] | 42 | ] |
149 | 43 | for (addr, expected) in addresses: | 43 | for addr, expected in addresses: |
150 | 44 | self.assertEqual(sanitize_addr(addr), expected) | 44 | self.assertEqual(sanitize_addr(addr), expected) |
151 | diff --git a/reviewtools/tests/test_sr_declaration.py b/reviewtools/tests/test_sr_declaration.py | |||
152 | index cef3967..3d58737 100644 | |||
153 | --- a/reviewtools/tests/test_sr_declaration.py | |||
154 | +++ b/reviewtools/tests/test_sr_declaration.py | |||
155 | @@ -7729,7 +7729,6 @@ slots: | |||
156 | 7729 | ], | 7729 | ], |
157 | 7730 | ), | 7730 | ), |
158 | 7731 | ]: | 7731 | ]: |
159 | 7732 | |||
160 | 7733 | self.set_test_snap_yaml("plugs", plugs) | 7732 | self.set_test_snap_yaml("plugs", plugs) |
161 | 7734 | overrides = {"snap_decl_plugs": {"iface": {"%s" % (cstr): overrides}}} | 7733 | overrides = {"snap_decl_plugs": {"iface": {"%s" % (cstr): overrides}}} |
162 | 7735 | c = SnapReviewDeclaration(self.test_name, overrides=overrides) | 7734 | c = SnapReviewDeclaration(self.test_name, overrides=overrides) |
163 | @@ -7835,7 +7834,6 @@ slots: | |||
164 | 7835 | ], | 7834 | ], |
165 | 7836 | ), | 7835 | ), |
166 | 7837 | ]: | 7836 | ]: |
167 | 7838 | |||
168 | 7839 | self.set_test_snap_yaml("plugs", plugs) | 7837 | self.set_test_snap_yaml("plugs", plugs) |
169 | 7840 | overrides = {"snap_decl_plugs": {"iface": {"%s" % (cstr): overrides}}} | 7838 | overrides = {"snap_decl_plugs": {"iface": {"%s" % (cstr): overrides}}} |
170 | 7841 | c = SnapReviewDeclaration(self.test_name, overrides=overrides) | 7839 | c = SnapReviewDeclaration(self.test_name, overrides=overrides) |
171 | @@ -7911,7 +7909,6 @@ slots: | |||
172 | 7911 | ], | 7909 | ], |
173 | 7912 | ), | 7910 | ), |
174 | 7913 | ]: | 7911 | ]: |
175 | 7914 | |||
176 | 7915 | self.set_test_snap_yaml("plugs", plugs) | 7912 | self.set_test_snap_yaml("plugs", plugs) |
177 | 7916 | overrides = {"snap_decl_plugs": {"iface": {"%s" % (cstr): overrides}}} | 7913 | overrides = {"snap_decl_plugs": {"iface": {"%s" % (cstr): overrides}}} |
178 | 7917 | c = SnapReviewDeclaration(self.test_name, overrides=overrides) | 7914 | c = SnapReviewDeclaration(self.test_name, overrides=overrides) |
179 | diff --git a/reviewtools/tests/test_sr_functional.py b/reviewtools/tests/test_sr_functional.py | |||
180 | index ebd760e..8b97757 100644 | |||
181 | --- a/reviewtools/tests/test_sr_functional.py | |||
182 | +++ b/reviewtools/tests/test_sr_functional.py | |||
183 | @@ -284,7 +284,7 @@ crw-rw-rw- 0/0 1, 3 2020-03-14 18:21 squashfs-root/dev/null | |||
184 | 284 | hdr, entries = unsquashfs_lln_parse(lln) | 284 | hdr, entries = unsquashfs_lln_parse(lln) |
185 | 285 | 285 | ||
186 | 286 | state = {} | 286 | state = {} |
188 | 287 | for (line, item) in entries: | 287 | for line, item in entries: |
189 | 288 | state[item[StatLLN.FILENAME]] = item | 288 | state[item[StatLLN.FILENAME]] = item |
190 | 289 | if "libc-2.31.so" in line: | 289 | if "libc-2.31.so" in line: |
191 | 290 | state[item[StatLLN.FILENAME]]["symbols"] = { | 290 | state[item[StatLLN.FILENAME]]["symbols"] = { |
192 | @@ -297,7 +297,7 @@ crw-rw-rw- 0/0 1, 3 2020-03-14 18:21 squashfs-root/dev/null | |||
193 | 297 | 297 | ||
194 | 298 | self.assertEqual(len(entries), len(serial)) | 298 | self.assertEqual(len(entries), len(serial)) |
195 | 299 | self.assertEqual(len(serial), 7) | 299 | self.assertEqual(len(serial), 7) |
197 | 300 | for (idx, map) in [ | 300 | for idx, map in [ |
198 | 301 | (".", {"filetype": "d", "mode": "rwxr-xr-x", "owner": "0/0"}), | 301 | (".", {"filetype": "d", "mode": "rwxr-xr-x", "owner": "0/0"}), |
199 | 302 | ("./bin", {"filetype": "d", "mode": "rwxr-xr-x", "owner": "0/0"}), | 302 | ("./bin", {"filetype": "d", "mode": "rwxr-xr-x", "owner": "0/0"}), |
200 | 303 | ("./bin/cat", {"filetype": "-", "mode": "rwxr-xr-x", "owner": "0/0"}), | 303 | ("./bin/cat", {"filetype": "-", "mode": "rwxr-xr-x", "owner": "0/0"}), |
201 | @@ -378,7 +378,7 @@ crw-rw-rw- 0/0 1, 3 2020-03-14 18:21 squashfs-root/dev/null | |||
202 | 378 | c = SnapReviewFunctional(self.test_name) | 378 | c = SnapReviewFunctional(self.test_name) |
203 | 379 | 379 | ||
204 | 380 | state = {} | 380 | state = {} |
206 | 381 | for (line, item) in entries: | 381 | for line, item in entries: |
207 | 382 | state[item[StatLLN.FILENAME]] = item | 382 | state[item[StatLLN.FILENAME]] = item |
208 | 383 | 383 | ||
209 | 384 | serial = c._serialize(state) | 384 | serial = c._serialize(state) |
210 | @@ -451,7 +451,7 @@ crw-rw-rw- 0/0 1, 3 2020-03-14 18:21 squashfs-root/dev/null | |||
211 | 451 | self.assertEqual(len(state), len(entries)) | 451 | self.assertEqual(len(state), len(entries)) |
212 | 452 | self.assertEqual(len(state), 7) | 452 | self.assertEqual(len(state), 7) |
213 | 453 | 453 | ||
215 | 454 | for (idx, item) in [ | 454 | for idx, item in [ |
216 | 455 | ( | 455 | ( |
217 | 456 | ".", | 456 | ".", |
218 | 457 | { | 457 | { |
219 | diff --git a/reviewtools/tests/test_sr_lint.py b/reviewtools/tests/test_sr_lint.py | |||
220 | index 692e77e..46f141c 100644 | |||
221 | --- a/reviewtools/tests/test_sr_lint.py | |||
222 | +++ b/reviewtools/tests/test_sr_lint.py | |||
223 | @@ -1000,7 +1000,9 @@ class TestSnapReviewLint(sr_tests.TestSnapReview): | |||
224 | 1000 | def test_check_link_with_tilde(self): | 1000 | def test_check_link_with_tilde(self): |
225 | 1001 | """Test check_link""" | 1001 | """Test check_link""" |
226 | 1002 | links = { | 1002 | links = { |
228 | 1003 | "source-code": ["https://code.launchpad.net/~chromium-team/chromium-browser/+git/snap-from-source/+ref/stable"], | 1003 | "source-code": [ |
229 | 1004 | "https://code.launchpad.net/~chromium-team/chromium-browser/+git/snap-from-source/+ref/stable" | ||
230 | 1005 | ], | ||
231 | 1004 | } | 1006 | } |
232 | 1005 | self.set_test_snap_yaml("links", links) | 1007 | self.set_test_snap_yaml("links", links) |
233 | 1006 | c = SnapReviewLint(self.test_name) | 1008 | c = SnapReviewLint(self.test_name) |
234 | @@ -4753,7 +4755,7 @@ class TestSnapReviewLint(sr_tests.TestSnapReview): | |||
235 | 4753 | "lint-snap-v2:base_valid": { | 4755 | "lint-snap-v2:base_valid": { |
236 | 4754 | "text": "(NEEDS REVIEW) snap grade (stable) does not match base grade (stable)" | 4756 | "text": "(NEEDS REVIEW) snap grade (stable) does not match base grade (stable)" |
237 | 4755 | } | 4757 | } |
239 | 4756 | } | 4758 | }, |
240 | 4757 | } | 4759 | } |
241 | 4758 | self.check_results(r, expected=expected) | 4760 | self.check_results(r, expected=expected) |
242 | 4759 | name = c._get_check_name("base_valid") | 4761 | name = c._get_check_name("base_valid") |
243 | @@ -5071,7 +5073,9 @@ class TestSnapReviewLint(sr_tests.TestSnapReview): | |||
244 | 5071 | expected_counts = {"info": 2, "warn": 0, "error": 0} | 5073 | expected_counts = {"info": 2, "warn": 0, "error": 0} |
245 | 5072 | self.check_results(r, expected_counts) | 5074 | self.check_results(r, expected_counts) |
246 | 5073 | 5075 | ||
248 | 5074 | def test_check_sockets_invalid_listen_stream_snap_user_data_without_user_daemon_scope(self): | 5076 | def test_check_sockets_invalid_listen_stream_snap_user_data_without_user_daemon_scope( |
249 | 5077 | self, | ||
250 | 5078 | ): | ||
251 | 5075 | """Test check_apps_sockets() - invalid listen-stream SNAP_USER_DATA without user daemon-scope""" | 5079 | """Test check_apps_sockets() - invalid listen-stream SNAP_USER_DATA without user daemon-scope""" |
252 | 5076 | self.set_test_snap_yaml( | 5080 | self.set_test_snap_yaml( |
253 | 5077 | "apps", | 5081 | "apps", |
254 | @@ -5088,8 +5092,12 @@ class TestSnapReviewLint(sr_tests.TestSnapReview): | |||
255 | 5088 | """Test check_apps_sockets() - valid listen-stream SNAP_USER_DATA with user daemon-scope""" | 5092 | """Test check_apps_sockets() - valid listen-stream SNAP_USER_DATA with user daemon-scope""" |
256 | 5089 | self.set_test_snap_yaml( | 5093 | self.set_test_snap_yaml( |
257 | 5090 | "apps", | 5094 | "apps", |
260 | 5091 | {"foo": {"sockets": {"sock1": {"listen-stream": "$SNAP_USER_DATA/sock"}}, | 5095 | { |
261 | 5092 | "daemon-scope": "user"}}, | 5096 | "foo": { |
262 | 5097 | "sockets": {"sock1": {"listen-stream": "$SNAP_USER_DATA/sock"}}, | ||
263 | 5098 | "daemon-scope": "user", | ||
264 | 5099 | } | ||
265 | 5100 | }, | ||
266 | 5093 | ) | 5101 | ) |
267 | 5094 | 5102 | ||
268 | 5095 | c = SnapReviewLint(self.test_name) | 5103 | c = SnapReviewLint(self.test_name) |
269 | @@ -5102,8 +5110,12 @@ class TestSnapReviewLint(sr_tests.TestSnapReview): | |||
270 | 5102 | """Test check_apps_sockets() - valid listen-stream SNAP_USER_COMMON with user daemon-scope""" | 5110 | """Test check_apps_sockets() - valid listen-stream SNAP_USER_COMMON with user daemon-scope""" |
271 | 5103 | self.set_test_snap_yaml( | 5111 | self.set_test_snap_yaml( |
272 | 5104 | "apps", | 5112 | "apps", |
275 | 5105 | {"foo": {"sockets": {"sock1": {"listen-stream": "$SNAP_USER_COMMON/sock"}}, | 5113 | { |
276 | 5106 | "daemon-scope": "user"}}, | 5114 | "foo": { |
277 | 5115 | "sockets": {"sock1": {"listen-stream": "$SNAP_USER_COMMON/sock"}}, | ||
278 | 5116 | "daemon-scope": "user", | ||
279 | 5117 | } | ||
280 | 5118 | }, | ||
281 | 5107 | ) | 5119 | ) |
282 | 5108 | 5120 | ||
283 | 5109 | c = SnapReviewLint(self.test_name) | 5121 | c = SnapReviewLint(self.test_name) |
284 | @@ -5116,8 +5128,12 @@ class TestSnapReviewLint(sr_tests.TestSnapReview): | |||
285 | 5116 | """Test check_apps_sockets() - valid listen-stream XDG_RUNTIME_DIR with user daemon-scope""" | 5128 | """Test check_apps_sockets() - valid listen-stream XDG_RUNTIME_DIR with user daemon-scope""" |
286 | 5117 | self.set_test_snap_yaml( | 5129 | self.set_test_snap_yaml( |
287 | 5118 | "apps", | 5130 | "apps", |
290 | 5119 | {"foo": {"sockets": {"sock1": {"listen-stream": "$XDG_RUNTIME_DIR/sock"}}, | 5131 | { |
291 | 5120 | "daemon-scope": "user"}}, | 5132 | "foo": { |
292 | 5133 | "sockets": {"sock1": {"listen-stream": "$XDG_RUNTIME_DIR/sock"}}, | ||
293 | 5134 | "daemon-scope": "user", | ||
294 | 5135 | } | ||
295 | 5136 | }, | ||
296 | 5121 | ) | 5137 | ) |
297 | 5122 | 5138 | ||
298 | 5123 | c = SnapReviewLint(self.test_name) | 5139 | c = SnapReviewLint(self.test_name) |
299 | @@ -6517,7 +6533,7 @@ class TestSnapReviewLint(sr_tests.TestSnapReview): | |||
300 | 6517 | ("snap.foo.bar.ico", None), | 6533 | ("snap.foo.bar.ico", None), |
301 | 6518 | ("snap.foo.bar", None), | 6534 | ("snap.foo.bar", None), |
302 | 6519 | ] | 6535 | ] |
304 | 6520 | for (fn, exreal) in valid: | 6536 | for fn, exreal in valid: |
305 | 6521 | valid, real_fn = c._verify_icon_path(fn) | 6537 | valid, real_fn = c._verify_icon_path(fn) |
306 | 6522 | self.assertTrue(valid) | 6538 | self.assertTrue(valid) |
307 | 6523 | self.assertEqual(real_fn, exreal) | 6539 | self.assertEqual(real_fn, exreal) |
308 | diff --git a/reviewtools/tests/test_sr_security.py b/reviewtools/tests/test_sr_security.py | |||
309 | index 9989747..de1cc44 100644 | |||
310 | --- a/reviewtools/tests/test_sr_security.py | |||
311 | +++ b/reviewtools/tests/test_sr_security.py | |||
312 | @@ -1071,7 +1071,7 @@ slots: | |||
313 | 1071 | (pkg, "/test", "rwxrwxrwt", {"/test": "rwxrwxrwt"}, True), | 1071 | (pkg, "/test", "rwxrwxrwt", {"/test": "rwxrwxrwt"}, True), |
314 | 1072 | (pkg, "/test", "rwxrwxrwt", {"/test": ["rwxrwxrwT", "rwxrwxrwt"]}, True), | 1072 | (pkg, "/test", "rwxrwxrwt", {"/test": ["rwxrwxrwT", "rwxrwxrwt"]}, True), |
315 | 1073 | ] | 1073 | ] |
317 | 1074 | for (p, f, m, override, exp) in tests: | 1074 | for p, f, m, override, exp in tests: |
318 | 1075 | if p is not None: | 1075 | if p is not None: |
319 | 1076 | sec_mode_overrides[p] = override | 1076 | sec_mode_overrides[p] = override |
320 | 1077 | c = SnapReviewSecurity(self.test_name) | 1077 | c = SnapReviewSecurity(self.test_name) |
321 | diff --git a/reviewtools/tests/test_store.py b/reviewtools/tests/test_store.py | |||
322 | index cd6c3d1..5c1b8cd 100644 | |||
323 | --- a/reviewtools/tests/test_store.py | |||
324 | +++ b/reviewtools/tests/test_store.py | |||
325 | @@ -594,7 +594,8 @@ class TestStore(TestCase): | |||
326 | 594 | self, | 594 | self, |
327 | 595 | ): | 595 | ): |
328 | 596 | """Test get_package_revisions() - parts/stage-packages and | 596 | """Test get_package_revisions() - parts/stage-packages and |
330 | 597 | primed-stage-packages are None has no security notices if no usn for build-pkgs""" | 597 | primed-stage-packages are None has no security notices if no usn for build-pkgs |
331 | 598 | """ | ||
332 | 598 | for i in range(len(self.store_db[0]["revisions"])): | 599 | for i in range(len(self.store_db[0]["revisions"])): |
333 | 599 | m = yaml.load( | 600 | m = yaml.load( |
334 | 600 | self.store_db[0]["revisions"][i]["manifest_yaml"], | 601 | self.store_db[0]["revisions"][i]["manifest_yaml"], |
335 | @@ -1211,7 +1212,12 @@ class TestStore(TestCase): | |||
336 | 1211 | 1212 | ||
337 | 1212 | def test_check_get_secnots_ignore_pockets(self): | 1213 | def test_check_get_secnots_ignore_pockets(self): |
338 | 1213 | """Test get_secnots_for_manifest() - ignore_pockets""" | 1214 | """Test get_secnots_for_manifest() - ignore_pockets""" |
340 | 1214 | for ignore_pockets in [[], ["esm-apps"], ["esm-apps/focal"], ["esm-apps/jammy"]]: | 1215 | for ignore_pockets in [ |
341 | 1216 | [], | ||
342 | 1217 | ["esm-apps"], | ||
343 | 1218 | ["esm-apps/focal"], | ||
344 | 1219 | ["esm-apps/jammy"], | ||
345 | 1220 | ]: | ||
346 | 1215 | m = yaml.load( | 1221 | m = yaml.load( |
347 | 1216 | self.store_esm_apps_db[0]["revisions"][0]["manifest_yaml"], | 1222 | self.store_esm_apps_db[0]["revisions"][0]["manifest_yaml"], |
348 | 1217 | Loader=yaml.SafeLoader, | 1223 | Loader=yaml.SafeLoader, |
349 | @@ -2174,7 +2180,7 @@ class TestStore(TestCase): | |||
350 | 2174 | ("4.4.0-161", "4.4.0.161.999999"), | 2180 | ("4.4.0-161", "4.4.0.161.999999"), |
351 | 2175 | ("4.4.0-140-1", "4.4.0.140.999999"), | 2181 | ("4.4.0-140-1", "4.4.0.140.999999"), |
352 | 2176 | ] | 2182 | ] |
354 | 2177 | for (v, expected) in tests: | 2183 | for v, expected in tests: |
355 | 2178 | res = store.convert_canonical_kernel_version(v) | 2184 | res = store.convert_canonical_kernel_version(v) |
356 | 2179 | self.assertEqual(res, expected) | 2185 | self.assertEqual(res, expected) |
357 | 2180 | 2186 | ||
358 | @@ -2190,7 +2196,7 @@ class TestStore(TestCase): | |||
359 | 2190 | ("1.2-3+git1234ubuntu0.1", "1.2-3+git1234ubuntu0.1"), | 2196 | ("1.2-3+git1234ubuntu0.1", "1.2-3+git1234ubuntu0.1"), |
360 | 2191 | ("1.2-3+git1234ubuntu0.1+deadbeef", "1.2-3+git1234ubuntu0.1"), | 2197 | ("1.2-3+git1234ubuntu0.1+deadbeef", "1.2-3+git1234ubuntu0.1"), |
361 | 2192 | ] | 2198 | ] |
363 | 2193 | for (v, expected) in tests: | 2199 | for v, expected in tests: |
364 | 2194 | res = store.convert_canonical_app_version(v) | 2200 | res = store.convert_canonical_app_version(v) |
365 | 2195 | self.assertEqual(res, expected) | 2201 | self.assertEqual(res, expected) |
366 | 2196 | 2202 | ||
367 | @@ -2600,7 +2606,12 @@ class TestStore(TestCase): | |||
368 | 2600 | def test_check_get_package_revisions_ignore_pockets(self): | 2606 | def test_check_get_package_revisions_ignore_pockets(self): |
369 | 2601 | """Test get_package_revisions() - ignore_pockets=esm-apps""" | 2607 | """Test get_package_revisions() - ignore_pockets=esm-apps""" |
370 | 2602 | errors = {} | 2608 | errors = {} |
372 | 2603 | for ignore_pockets in [[], ["esm-apps"], ["esm-apps/focal"], ["esm-apps/jammy"]]: | 2609 | for ignore_pockets in [ |
373 | 2610 | [], | ||
374 | 2611 | ["esm-apps"], | ||
375 | 2612 | ["esm-apps/focal"], | ||
376 | 2613 | ["esm-apps/jammy"], | ||
377 | 2614 | ]: | ||
378 | 2604 | with self.subTest(): | 2615 | with self.subTest(): |
379 | 2605 | res = store.get_pkg_revisions( | 2616 | res = store.get_pkg_revisions( |
380 | 2606 | read_file_as_json_dict("./tests/test-store-unittest-esm-apps.db")[ | 2617 | read_file_as_json_dict("./tests/test-store-unittest-esm-apps.db")[ |
LGTM - as seen in the lpci test log:
:: ./run-black __init_ _.py available. py common. py debversion. py email.py modules. py overrides. py rr_common. py sr_common. py sr_declaration. py sr_functional. py sr_lint. py sr_security. py sr_skeleton. py sr_tests. py store.py usn.py tests/_ _init__ .py tests/test_ available. py tests/test_ bbb_example_ sr_skeleton. py tests/test_ common. py tests/test_ debversion. py tests/test_ email.py tests/test_ modules. py tests/test_ sr_common. py tests/test_ sr_declaration. py tests/test_ sr_functional. py tests/test_ sr_lint. py tests/test_ sr_security. py tests/test_ store.py tests/test_ usn.py tests/utils. py snap-declaratio n base-declaratio n updates- available updates- available check-declarati on check-lint check-security check-skeleton verify- declaration
:: = black =
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./reviewtools/
:: Checking ./bin/snap-review
:: Checking ./bin/create-
:: Checking ./bin/dump-tool
:: Checking ./bin/get-
:: Checking ./bin/store-query
:: Checking ./bin/rock-
:: Checking ./bin/snap-
:: Checking ./bin/snap-
:: Checking ./bin/snap-
:: Checking ./bin/snap-
:: Checking ./bin/snap-
:: Checking ./bin/snap-