Merge lp:~laney/ubuntu-cdimage/fix-tests into lp:ubuntu-cdimage

Proposed by Iain Lane
Status: Merged
Merged at revision: 1933
Proposed branch: lp:~laney/ubuntu-cdimage/fix-tests
Merge into: lp:ubuntu-cdimage
Prerequisite: lp:~laney/ubuntu-cdimage/stop-sync-mirrors
Diff against target: 95 lines (+15/-6)
4 files modified
lib/cdimage/livefs.py (+2/-1)
lib/cdimage/tests/test_mirror.py (+2/-1)
lib/cdimage/tests/test_static.py (+1/-1)
lib/cdimage/tests/test_tree.py (+10/-3)
To merge this branch: bzr merge lp:~laney/ubuntu-cdimage/fix-tests
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Ɓukasz Zemczak Pending
Review via email: mp+398107@code.launchpad.net

Description of the change

Fix torrent tests, then fix up pep8/pyflakes tests.

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

Now ./run-tests works, for me at least!

Revision history for this message
Steve Langasek (vorlon) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/cdimage/livefs.py'
2--- lib/cdimage/livefs.py 2021-01-11 16:22:59 +0000
3+++ lib/cdimage/livefs.py 2021-02-16 11:34:00 +0000
4@@ -83,7 +83,8 @@
5 # boards, thus specify subarch for livefs build. However, we
6 # don't want +subarch in the published image names. Hence
7 # default-arches does not specify anything.
8- # TODO add support to specify the above via image_format metadata_override.
9+ # TODO add support to specify the above via image_format
10+ # metadata_override.
11 subarch = "hifive"
12
13 return cpuarch, subarch
14
15=== modified file 'lib/cdimage/tests/test_mirror.py'
16--- lib/cdimage/tests/test_mirror.py 2021-02-16 11:34:00 +0000
17+++ lib/cdimage/tests/test_mirror.py 2021-02-16 11:34:00 +0000
18@@ -229,6 +229,7 @@
19 def test_no_trigger_mirrors_when_stopped(self, mock_trigger_mirror):
20 self.configure_triggers()
21 os.mkdir(os.path.join(self.config.root, "etc"))
22- with open(os.path.join(self.config.root, "etc", "STOP_SYNC_MIRRORS"), "w"):
23+ with open(os.path.join(self.config.root, "etc", "STOP_SYNC_MIRRORS"),
24+ "w"):
25 trigger_mirrors(self.config)
26 mock_trigger_mirror.assert_not_called()
27
28=== modified file 'lib/cdimage/tests/test_static.py'
29--- lib/cdimage/tests/test_static.py 2015-10-26 11:06:11 +0000
30+++ lib/cdimage/tests/test_static.py 2021-02-16 11:34:00 +0000
31@@ -92,7 +92,7 @@
32 if line.startswith("#"):
33 continue
34 line = line.rstrip()
35- canon_line = re.sub(r":[0-9]+:", ":*:", line, 1)
36+ canon_line = re.sub(r":[0-9]+:(?:[0-9]+)?", ":*:", line, 1)
37 canon_line = re.sub(r"line [0-9]+", "line *", canon_line)
38 if canon_line not in exclusions:
39 print(line)
40
41=== modified file 'lib/cdimage/tests/test_tree.py'
42--- lib/cdimage/tests/test_tree.py 2020-12-10 17:32:42 +0000
43+++ lib/cdimage/tests/test_tree.py 2021-02-16 11:34:00 +0000
44@@ -2505,9 +2505,11 @@
45 command_base = [
46 "mktorrent", "-a", "https://torrent.ubuntu.com/announce",
47 "--comment", "Ubuntu CD cdimage.ubuntu.com",
48+ "--output",
49 ]
50 mock_check_call.assert_has_calls([
51- mock.call(command_base + [path], stdout=mock.ANY)
52+ mock.call(command_base + ["%s.torrent" % path, path],
53+ stdout=mock.ANY)
54 for path in paths])
55
56 def test_publish_release_prefixes(self):
57@@ -2570,6 +2572,7 @@
58 mock.call([
59 "mktorrent", mock.ANY, mock.ANY,
60 "--comment", "Ubuntu CD cdimage.ubuntu.com",
61+ "--output", "%s.iso.torrent" % target_base,
62 "%s.iso" % target_base,
63 ], stdout=mock.ANY),
64 ])
65@@ -2621,6 +2624,7 @@
66 mock_call.assert_called_once_with([
67 "mktorrent", mock.ANY, mock.ANY,
68 "--comment", "Ubuntu CD cdimage.ubuntu.com",
69+ "--output", "%s.iso.torrent" % target_base,
70 "%s.iso" % target_base,
71 ], stdout=mock.ANY)
72 self.assertCountEqual([
73@@ -2796,9 +2800,11 @@
74 "-a", "https://torrent.ubuntu.com/announce",
75 "-a", "https://ipv6.torrent.ubuntu.com/announce",
76 "--comment", "Ubuntu CD releases.ubuntu.com",
77+ "--output",
78 ]
79 mock_check_call.assert_has_calls([
80- mock.call(command_base + [path], stdout=mock.ANY)
81+ mock.call(command_base + ["%s.torrent" % path, path],
82+ stdout=mock.ANY)
83 for path in paths])
84
85 def test_publish_release_prefixes(self):
86@@ -2876,7 +2882,8 @@
87 "-a", mock.ANY,
88 "-a", mock.ANY,
89 "--comment", "Ubuntu CD releases.ubuntu.com",
90- "%s.iso" % target_base,
91+ "--output", "%s.iso.torrent" % target_base,
92+ "%s.iso" % target_base
93 ], stdout=mock.ANY),
94 ])
95 self.assertCountEqual([

Subscribers

People subscribed via source and target branches