Merge lp:~cjwatson/launchpad/archivepublisher-tests-future-imports into lp:launchpad

Proposed by Colin Watson on 2018-02-02
Status: Merged
Merged at revision: 18570
Proposed branch: lp:~cjwatson/launchpad/archivepublisher-tests-future-imports
Merge into: lp:launchpad
Prerequisite: lp:~cjwatson/launchpad/soyuz-tests-future-imports
Diff against target: 1478 lines (+330/-279)
26 files modified
lib/lp/archivepublisher/tests/__init__.py (+3/-1)
lib/lp/archivepublisher/tests/test_archivesigningkey.py (+3/-1)
lib/lp/archivepublisher/tests/test_config.py (+3/-1)
lib/lp/archivepublisher/tests/test_customupload.py (+3/-1)
lib/lp/archivepublisher/tests/test_ddtp_tarball.py (+10/-8)
lib/lp/archivepublisher/tests/test_deathrow.py (+3/-1)
lib/lp/archivepublisher/tests/test_debian_installer.py (+10/-8)
lib/lp/archivepublisher/tests/test_debversion.py (+3/-1)
lib/lp/archivepublisher/tests/test_dist_upgrader.py (+8/-6)
lib/lp/archivepublisher/tests/test_dominator.py (+3/-1)
lib/lp/archivepublisher/tests/test_ftparchive.py (+7/-5)
lib/lp/archivepublisher/tests/test_generate_contents_files.py (+3/-1)
lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py (+17/-15)
lib/lp/archivepublisher/tests/test_htaccess.py (+7/-5)
lib/lp/archivepublisher/tests/test_indices.py (+136/-134)
lib/lp/archivepublisher/tests/test_pool.py (+3/-1)
lib/lp/archivepublisher/tests/test_processaccepted.py (+4/-2)
lib/lp/archivepublisher/tests/test_processdeathrow.py (+5/-3)
lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+4/-2)
lib/lp/archivepublisher/tests/test_publishdistro.py (+3/-1)
lib/lp/archivepublisher/tests/test_publisher.py (+12/-10)
lib/lp/archivepublisher/tests/test_publisher_documentation.py (+3/-1)
lib/lp/archivepublisher/tests/test_publisherconfig.py (+10/-8)
lib/lp/archivepublisher/tests/test_repositoryindexfile.py (+3/-1)
lib/lp/archivepublisher/tests/test_rosetta_translations.py (+5/-3)
lib/lp/archivepublisher/tests/test_signing.py (+59/-58)
To merge this branch: bzr merge lp:~cjwatson/launchpad/archivepublisher-tests-future-imports
Reviewer Review Type Date Requested Status
William Grant code 2018-02-02 Approve on 2018-03-02
Review via email: mp+337053@code.launchpad.net

Commit message

Convert lp.archivepublisher.tests to Launchpad's preferred __future__ imports.

Description of the change

The contents of files in tarfiles need to remain as bytes, but everything else was easy.

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archivepublisher/tests/__init__.py'
2--- lib/lp/archivepublisher/tests/__init__.py 2010-08-20 20:31:18 +0000
3+++ lib/lp/archivepublisher/tests/__init__.py 2018-02-02 11:57:41 +0000
4@@ -1,6 +1,8 @@
5-# Copyright 2009 Canonical Ltd. This software is licensed under the
6+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9+from __future__ import absolute_import, print_function, unicode_literals
10+
11 import os
12
13
14
15=== modified file 'lib/lp/archivepublisher/tests/test_archivesigningkey.py'
16--- lib/lp/archivepublisher/tests/test_archivesigningkey.py 2017-04-29 15:24:32 +0000
17+++ lib/lp/archivepublisher/tests/test_archivesigningkey.py 2018-02-02 11:57:41 +0000
18@@ -1,8 +1,10 @@
19-# Copyright 2016-2017 Canonical Ltd. This software is licensed under the
20+# Copyright 2016-2018 Canonical Ltd. This software is licensed under the
21 # GNU Affero General Public License version 3 (see the file LICENSE).
22
23 """Test ArchiveSigningKey."""
24
25+from __future__ import absolute_import, print_function, unicode_literals
26+
27 __metaclass__ = type
28
29 import os
30
31=== modified file 'lib/lp/archivepublisher/tests/test_config.py'
32--- lib/lp/archivepublisher/tests/test_config.py 2016-05-04 14:49:37 +0000
33+++ lib/lp/archivepublisher/tests/test_config.py 2018-02-02 11:57:41 +0000
34@@ -1,4 +1,4 @@
35-# Copyright 2011-2016 Canonical Ltd. This software is licensed under the
36+# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
37 # GNU Affero General Public License version 3 (see the file LICENSE).
38
39 """Test publisher configs handling.
40@@ -6,6 +6,8 @@
41 Publisher configuration provides archive-dependent filesystem paths.
42 """
43
44+from __future__ import absolute_import, print_function, unicode_literals
45+
46 __metaclass__ = type
47
48 import os
49
50=== modified file 'lib/lp/archivepublisher/tests/test_customupload.py'
51--- lib/lp/archivepublisher/tests/test_customupload.py 2012-05-28 13:13:53 +0000
52+++ lib/lp/archivepublisher/tests/test_customupload.py 2018-02-02 11:57:41 +0000
53@@ -1,8 +1,10 @@
54-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
55+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
56 # GNU Affero General Public License version 3 (see the file LICENSE).
57
58 """Tests for `CustomUploads`."""
59
60+from __future__ import absolute_import, print_function, unicode_literals
61+
62 __metaclass__ = type
63
64
65
66=== modified file 'lib/lp/archivepublisher/tests/test_ddtp_tarball.py'
67--- lib/lp/archivepublisher/tests/test_ddtp_tarball.py 2016-06-07 17:07:35 +0000
68+++ lib/lp/archivepublisher/tests/test_ddtp_tarball.py 2018-02-02 11:57:41 +0000
69@@ -1,4 +1,4 @@
70-# Copyright 2012-2016 Canonical Ltd. This software is licensed under the
71+# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
72 # GNU Affero General Public License version 3 (see the file LICENSE).
73
74 """Test ddtp-tarball custom uploads.
75@@ -7,6 +7,8 @@
76 tests of ddtp-tarball upload and queue manipulation.
77 """
78
79+from __future__ import absolute_import, print_function, unicode_literals
80+
81 import os
82
83 from zope.component import getUtility
84@@ -57,7 +59,7 @@
85 def test_basic(self):
86 # Processing a simple correct tar file works.
87 self.openArchive("20060728")
88- self.tarfile.add_file("i18n/Translation-de", "")
89+ self.tarfile.add_file("i18n/Translation-de", b"")
90 self.process()
91 self.assertTrue(os.path.exists(
92 self.getTranslationsPath("Translation-de")))
93@@ -65,7 +67,7 @@
94 def test_ignores_empty_directories(self):
95 # Empty directories in the tarball are not extracted.
96 self.openArchive("20060728")
97- self.tarfile.add_file("i18n/Translation-de", "")
98+ self.tarfile.add_file("i18n/Translation-de", b"")
99 self.tarfile.add_directory("i18n/foo")
100 self.process()
101 self.assertTrue(os.path.exists(
102@@ -76,15 +78,15 @@
103 # If a DDTP tarball only contains a subset of published translation
104 # files, these are updated and the rest are left untouched.
105 self.openArchive("20060728")
106- self.tarfile.add_file("i18n/Translation-bn", "bn")
107- self.tarfile.add_file("i18n/Translation-ca", "ca")
108+ self.tarfile.add_file("i18n/Translation-bn", b"bn")
109+ self.tarfile.add_file("i18n/Translation-ca", b"ca")
110 self.process()
111 with open(self.getTranslationsPath("Translation-bn")) as bn_file:
112 self.assertEqual("bn", bn_file.read())
113 with open(self.getTranslationsPath("Translation-ca")) as ca_file:
114 self.assertEqual("ca", ca_file.read())
115 self.openArchive("20060817")
116- self.tarfile.add_file("i18n/Translation-bn", "new bn")
117+ self.tarfile.add_file("i18n/Translation-bn", b"new bn")
118 self.process()
119 with open(self.getTranslationsPath("Translation-bn")) as bn_file:
120 self.assertEqual("new bn", bn_file.read())
121@@ -98,7 +100,7 @@
122 # into place, so making this work requires special care. Test that
123 # that care has been taken.
124 self.openArchive("20060728")
125- self.tarfile.add_file("i18n/Translation-ca", "")
126+ self.tarfile.add_file("i18n/Translation-ca", b"")
127 self.process()
128 ca = self.getTranslationsPath("Translation-ca")
129 bn = self.getTranslationsPath("Translation-bn")
130@@ -107,7 +109,7 @@
131 self.assertEqual(2, os.stat(bn).st_nlink)
132 self.assertEqual(2, os.stat(ca).st_nlink)
133 self.openArchive("20060817")
134- self.tarfile.add_file("i18n/Translation-bn", "break hard link")
135+ self.tarfile.add_file("i18n/Translation-bn", b"break hard link")
136 self.process()
137 with open(bn) as bn_file:
138 self.assertEqual("break hard link", bn_file.read())
139
140=== modified file 'lib/lp/archivepublisher/tests/test_deathrow.py'
141--- lib/lp/archivepublisher/tests/test_deathrow.py 2016-09-24 06:21:55 +0000
142+++ lib/lp/archivepublisher/tests/test_deathrow.py 2018-02-02 11:57:41 +0000
143@@ -1,8 +1,10 @@
144-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
145+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
146 # GNU Affero General Public License version 3 (see the file LICENSE).
147
148 """Tests for deathrow class."""
149
150+from __future__ import absolute_import, print_function, unicode_literals
151+
152 __metaclass__ = type
153
154
155
156=== modified file 'lib/lp/archivepublisher/tests/test_debian_installer.py'
157--- lib/lp/archivepublisher/tests/test_debian_installer.py 2016-06-07 17:07:35 +0000
158+++ lib/lp/archivepublisher/tests/test_debian_installer.py 2018-02-02 11:57:41 +0000
159@@ -1,4 +1,4 @@
160-# Copyright 2012-2016 Canonical Ltd. This software is licensed under the
161+# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
162 # GNU Affero General Public License version 3 (see the file LICENSE).
163
164 """Test debian-installer custom uploads.
165@@ -7,6 +7,8 @@
166 high-level tests of debian-installer upload and queue manipulation.
167 """
168
169+from __future__ import absolute_import, print_function, unicode_literals
170+
171 import os
172
173 from zope.component import getUtility
174@@ -77,7 +79,7 @@
175 def test_basic(self):
176 # Processing a simple correct tar file succeeds.
177 self.openArchive()
178- self.addFile("hello", "world")
179+ self.addFile("hello", b"world")
180 self.process()
181
182 def test_already_exists(self):
183@@ -89,14 +91,14 @@
184 def test_bad_umask(self):
185 # The umask must be 0o022 to avoid incorrect permissions.
186 self.openArchive()
187- self.addFile("dir/file", "foo")
188+ self.addFile("dir/file", b"foo")
189 os.umask(0o002) # cleanup already handled by setUp
190 self.assertRaises(CustomUploadBadUmask, self.process)
191
192 def test_current_symlink(self):
193 # A "current" symlink is created to the last version.
194 self.openArchive()
195- self.addFile("hello", "world")
196+ self.addFile("hello", b"world")
197 self.process()
198 installer_path = self.getInstallerPath()
199 self.assertContentEqual(
200@@ -112,8 +114,8 @@
201 filename = os.path.join(directory, "default")
202 long_filename = os.path.join(
203 directory, "very_very_very_very_very_very_long_filename")
204- self.addFile(filename, "hey")
205- self.addFile(long_filename, "long")
206+ self.addFile(filename, b"hey")
207+ self.addFile(long_filename, b"long")
208 self.process()
209 with open(self.getInstallerPath(filename)) as f:
210 self.assertEqual("hey", f.read())
211@@ -140,7 +142,7 @@
212 def test_top_level_permissions(self):
213 # Top-level directories are set to mode 0o755 (see bug 107068).
214 self.openArchive()
215- self.addFile("hello", "world")
216+ self.addFile("hello", b"world")
217 self.process()
218 installer_path = self.getInstallerPath()
219 self.assertEqual(0o755, os.stat(installer_path).st_mode & 0o777)
220@@ -154,7 +156,7 @@
221 directory = ("images/netboot/ubuntu-installer/i386/"
222 "pxelinux.cfg.serial-9600")
223 filename = os.path.join(directory, "default")
224- self.addFile(filename, "hey")
225+ self.addFile(filename, b"hey")
226 self.process()
227 self.assertEqual(
228 0o644, os.stat(self.getInstallerPath(filename)).st_mode & 0o777)
229
230=== modified file 'lib/lp/archivepublisher/tests/test_debversion.py'
231--- lib/lp/archivepublisher/tests/test_debversion.py 2018-01-02 16:10:26 +0000
232+++ lib/lp/archivepublisher/tests/test_debversion.py 2018-02-02 11:57:41 +0000
233@@ -1,8 +1,10 @@
234-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
235+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
236 # GNU Affero General Public License version 3 (see the file LICENSE).
237
238 """Tests for debversion."""
239
240+from __future__ import absolute_import, print_function, unicode_literals
241+
242 __metaclass__ = type
243
244 # These tests came from sourcerer.
245
246=== modified file 'lib/lp/archivepublisher/tests/test_dist_upgrader.py'
247--- lib/lp/archivepublisher/tests/test_dist_upgrader.py 2016-06-07 17:07:35 +0000
248+++ lib/lp/archivepublisher/tests/test_dist_upgrader.py 2018-02-02 11:57:41 +0000
249@@ -1,4 +1,4 @@
250-# Copyright 2012-2016 Canonical Ltd. This software is licensed under the
251+# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
252 # GNU Affero General Public License version 3 (see the file LICENSE).
253
254 """Test dist-upgrader custom uploads.
255@@ -7,6 +7,8 @@
256 tests of dist-upgrader upload and queue manipulation.
257 """
258
259+from __future__ import absolute_import, print_function, unicode_literals
260+
261 import os
262
263 from zope.component import getUtility
264@@ -71,27 +73,27 @@
265 def test_basic(self):
266 # Processing a simple correct tar file works.
267 self.openArchive("20060302.0120")
268- self.tarfile.add_file("20060302.0120/hello", "world")
269+ self.tarfile.add_file("20060302.0120/hello", b"world")
270 self.process()
271
272 def test_already_exists(self):
273 # If the target directory already exists, processing fails.
274 self.openArchive("20060302.0120")
275- self.tarfile.add_file("20060302.0120/hello", "world")
276+ self.tarfile.add_file("20060302.0120/hello", b"world")
277 os.makedirs(os.path.join(self.getUpgraderPath(), "20060302.0120"))
278 self.assertRaises(CustomUploadAlreadyExists, self.process)
279
280 def test_bad_umask(self):
281 # The umask must be 0o022 to avoid incorrect permissions.
282 self.openArchive("20060302.0120")
283- self.tarfile.add_file("20060302.0120/file", "foo")
284+ self.tarfile.add_file("20060302.0120/file", b"foo")
285 os.umask(0o002) # cleanup already handled by setUp
286 self.assertRaises(CustomUploadBadUmask, self.process)
287
288 def test_current_symlink(self):
289 # A "current" symlink is created to the last version.
290 self.openArchive("20060302.0120")
291- self.tarfile.add_file("20060302.0120/hello", "world")
292+ self.tarfile.add_file("20060302.0120/hello", b"world")
293 self.process()
294 upgrader_path = self.getUpgraderPath()
295 self.assertContentEqual(
296@@ -106,7 +108,7 @@
297 def test_bad_version(self):
298 # Bad versions in the tarball are refused.
299 self.openArchive("20070219.1234")
300- self.tarfile.add_file("foobar/foobar/dapper.tar.gz", "")
301+ self.tarfile.add_file("foobar/foobar/dapper.tar.gz", b"")
302 self.assertRaises(DistUpgraderBadVersion, self.process)
303
304 def test_getSeriesKey_extracts_architecture(self):
305
306=== modified file 'lib/lp/archivepublisher/tests/test_dominator.py'
307--- lib/lp/archivepublisher/tests/test_dominator.py 2014-10-31 10:34:51 +0000
308+++ lib/lp/archivepublisher/tests/test_dominator.py 2018-02-02 11:57:41 +0000
309@@ -1,8 +1,10 @@
310-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
311+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
312 # GNU Affero General Public License version 3 (see the file LICENSE).
313
314 """Tests for domination.py."""
315
316+from __future__ import absolute_import, print_function, unicode_literals
317+
318 __metaclass__ = type
319
320 import datetime
321
322=== modified file 'lib/lp/archivepublisher/tests/test_ftparchive.py'
323--- lib/lp/archivepublisher/tests/test_ftparchive.py 2017-01-13 12:28:34 +0000
324+++ lib/lp/archivepublisher/tests/test_ftparchive.py 2018-02-02 11:57:41 +0000
325@@ -1,8 +1,10 @@
326-# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
327+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
328 # GNU Affero General Public License version 3 (see the file LICENSE).
329
330 """Tests for ftparchive.py"""
331
332+from __future__ import absolute_import, print_function, unicode_literals
333+
334 __metaclass__ = type
335
336 import difflib
337@@ -254,7 +256,7 @@
338 extra_overrides = os.path.join(
339 self._confdir, "more-extra.override.hoary-test.main")
340 with open(extra_overrides, "w") as extra_override_file:
341- print >>extra_override_file, " ".join(sentinel)
342+ print(" ".join(sentinel), file=extra_override_file)
343 self._publishDefaultOverrides(fa, 'universe')
344
345 result_path = os.path.join(
346@@ -332,7 +334,7 @@
347 self._publisher = SamplePublisher(self._archive)
348 fa = self._setUpFTPArchiveHandler()
349 pubs = self._archive.getAllPublishedBinaries(
350- name=u"pmount", status=PackagePublishingStatus.PUBLISHED,
351+ name="pmount", status=PackagePublishingStatus.PUBLISHED,
352 distroarchseries=self._distribution.getSeries("hoary")["hppa"])
353 for pub in pubs:
354 pub.changeOverride(new_phased_update_percentage=30).setPublished()
355@@ -377,10 +379,10 @@
356
357 def makeDDEBPub(self, series):
358 self.factory.makeBinaryPackagePublishingHistory(
359- binarypackagename=u'foo', sourcepackagename='foo', version='666',
360+ binarypackagename='foo', sourcepackagename='foo', version='666',
361 archive=series.main_archive, distroarchseries=series['hppa'],
362 pocket=PackagePublishingPocket.RELEASE,
363- component=u'main', with_debug=True, with_file=True,
364+ component='main', with_debug=True, with_file=True,
365 status=PackagePublishingStatus.PUBLISHED,
366 architecturespecific=True)
367
368
369=== modified file 'lib/lp/archivepublisher/tests/test_generate_contents_files.py'
370--- lib/lp/archivepublisher/tests/test_generate_contents_files.py 2016-11-01 10:28:15 +0000
371+++ lib/lp/archivepublisher/tests/test_generate_contents_files.py 2018-02-02 11:57:41 +0000
372@@ -1,8 +1,10 @@
373-# Copyright 2011-2016 Canonical Ltd. This software is licensed under the
374+# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
375 # GNU Affero General Public License version 3 (see the file LICENSE).
376
377 """Test for the `generate-contents-files` script."""
378
379+from __future__ import absolute_import, print_function, unicode_literals
380+
381 __metaclass__ = type
382
383 import hashlib
384
385=== modified file 'lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py'
386--- lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2016-07-14 14:12:23 +0000
387+++ lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2018-02-02 11:57:41 +0000
388@@ -1,8 +1,10 @@
389-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
390+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
391 # GNU Affero General Public License version 3 (see the file LICENSE).
392
393 """Test the generate_ppa_htaccess.py script. """
394
395+from __future__ import absolute_import, print_function, unicode_literals
396+
397 import crypt
398 from datetime import (
399 datetime,
400@@ -75,7 +77,7 @@
401 self.ppa.distribution = ubuntutest
402
403 # Enable named auth tokens.
404- self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"}))
405+ self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"}))
406
407 def getScript(self, test_args=None):
408 """Return a HtaccessTokenGenerator instance."""
409@@ -266,8 +268,8 @@
410 team1_person = persons1[0]
411
412 # Named tokens should be ignored for deactivation.
413- self.ppa.newNamedAuthToken(u"tokenname1")
414- named_token = self.ppa.newNamedAuthToken(u"tokenname2")
415+ self.ppa.newNamedAuthToken("tokenname1")
416+ named_token = self.ppa.newNamedAuthToken("tokenname2")
417 named_token.deactivate()
418
419 # Initially, nothing is eligible for deactivation.
420@@ -335,7 +337,7 @@
421 sub2 = self.ppa.newSubscription(name16, self.ppa.owner)
422 token1 = self.ppa.newAuthToken(name12)
423 token2 = self.ppa.newAuthToken(name16)
424- token3 = self.ppa.newNamedAuthToken(u"tokenname3")
425+ token3 = self.ppa.newNamedAuthToken("tokenname3")
426 self.layer.txn.commit()
427 return (sub1, sub2), (token1, token2, token3)
428
429@@ -384,9 +386,9 @@
430
431 def testBasicOperation_with_named_tokens(self):
432 """Invoke the actual script and make sure it generates some files."""
433- token1 = self.ppa.newNamedAuthToken(u"tokenname1")
434- token2 = self.ppa.newNamedAuthToken(u"tokenname2")
435- token3 = self.ppa.newNamedAuthToken(u"tokenname3")
436+ token1 = self.ppa.newNamedAuthToken("tokenname1")
437+ token2 = self.ppa.newNamedAuthToken("tokenname2")
438+ token3 = self.ppa.newNamedAuthToken("tokenname3")
439 token3.deactivate()
440
441 # Call the script and check that we have a .htaccess and a .htpasswd.
442@@ -641,10 +643,10 @@
443 last_start = datetime.now(pytz.UTC) - timedelta(seconds=90)
444 before_last_start = last_start - timedelta(seconds=30)
445
446- self.ppa.newNamedAuthToken(u"tokenname1")
447- token2 = self.ppa.newNamedAuthToken(u"tokenname2")
448+ self.ppa.newNamedAuthToken("tokenname1")
449+ token2 = self.ppa.newNamedAuthToken("tokenname2")
450 token2.deactivate()
451- token3 = self.ppa.newNamedAuthToken(u"tokenname3")
452+ token3 = self.ppa.newNamedAuthToken("tokenname3")
453 token3.date_deactivated = before_last_start
454
455 script = self.getScript()
456@@ -657,12 +659,12 @@
457 before_last_start = last_start - timedelta(seconds=30)
458 tomorrow = datetime.now(pytz.UTC) + timedelta(days=1)
459
460- self.ppa.newNamedAuthToken(u"tokenname1")
461- token2 = self.ppa.newNamedAuthToken(u"tokenname2")
462+ self.ppa.newNamedAuthToken("tokenname1")
463+ token2 = self.ppa.newNamedAuthToken("tokenname2")
464 token2.deactivate()
465- token3 = self.ppa.newNamedAuthToken(u"tokenname3")
466+ token3 = self.ppa.newNamedAuthToken("tokenname3")
467 token3.date_deactivated = before_last_start
468- token4 = self.ppa.newNamedAuthToken(u"tokenname4")
469+ token4 = self.ppa.newNamedAuthToken("tokenname4")
470 token4.date_deactivated = tomorrow
471
472 script = self.getScript()
473
474=== modified file 'lib/lp/archivepublisher/tests/test_htaccess.py'
475--- lib/lp/archivepublisher/tests/test_htaccess.py 2018-01-02 16:10:26 +0000
476+++ lib/lp/archivepublisher/tests/test_htaccess.py 2018-02-02 11:57:41 +0000
477@@ -1,8 +1,10 @@
478-# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
479+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
480 # GNU Affero General Public License version 3 (see the file LICENSE).
481
482 """Test htaccess/htpasswd file generation. """
483
484+from __future__ import absolute_import, print_function, unicode_literals
485+
486 import os
487 import tempfile
488
489@@ -39,7 +41,7 @@
490 self.ppa.distribution = ubuntutest
491
492 # Enable named auth tokens.
493- self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"}))
494+ self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"}))
495
496 def test_write_htpasswd(self):
497 """Test that writing the .htpasswd file works properly."""
498@@ -118,9 +120,9 @@
499 first_created_token = self.ppa.newAuthToken(name16)
500 second_created_token = self.ppa.newAuthToken(name12)
501 third_created_token = self.ppa.newAuthToken(hyphenated)
502- named_token_20 = self.ppa.newNamedAuthToken(u"name20", as_dict=False)
503- named_token_14 = self.ppa.newNamedAuthToken(u"name14", as_dict=False)
504- named_token_99 = self.ppa.newNamedAuthToken(u"name99", as_dict=False)
505+ named_token_20 = self.ppa.newNamedAuthToken("name20", as_dict=False)
506+ named_token_14 = self.ppa.newNamedAuthToken("name14", as_dict=False)
507+ named_token_99 = self.ppa.newNamedAuthToken("name99", as_dict=False)
508 named_token_99.deactivate()
509
510 expected_credentials = [
511
512=== modified file 'lib/lp/archivepublisher/tests/test_indices.py'
513--- lib/lp/archivepublisher/tests/test_indices.py 2016-02-05 15:16:29 +0000
514+++ lib/lp/archivepublisher/tests/test_indices.py 2018-02-02 11:57:41 +0000
515@@ -1,8 +1,10 @@
516-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
517+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
518 # GNU Affero General Public License version 3 (see the file LICENSE).
519
520 """Test native archive index generation for Soyuz."""
521
522+from __future__ import absolute_import, print_function, unicode_literals
523+
524 import os
525 import tempfile
526 import unittest
527@@ -70,27 +72,27 @@
528 ("Build-Conflicts-Arch", "libbar-dev")])
529
530 self.assertEqual(
531- [u'Package: foo',
532- u'Binary: foo-bin',
533- u'Version: 666',
534- u'Section: base',
535- u'Maintainer: Foo Bar <foo@bar.com>',
536- u'Build-Depends: fooish',
537- u'Build-Depends-Indep: pyfoo',
538- u'Build-Depends-Arch: libfoo-dev',
539- u'Build-Conflicts: bar',
540- u'Build-Conflicts-Indep: pybar',
541- u'Build-Conflicts-Arch: libbar-dev',
542- u'Architecture: all',
543- u'Standards-Version: 3.6.2',
544- u'Format: 1.0',
545- u'Directory: pool/main/f/foo',
546- u'Files:',
547- u' %s 28 foo_666.dsc' % self.dsc_md5,
548- u'Checksums-Sha1:',
549- u' %s 28 foo_666.dsc' % self.dsc_sha1,
550- u'Checksums-Sha256:',
551- u' %s 28 foo_666.dsc' % self.dsc_sha256,
552+ ['Package: foo',
553+ 'Binary: foo-bin',
554+ 'Version: 666',
555+ 'Section: base',
556+ 'Maintainer: Foo Bar <foo@bar.com>',
557+ 'Build-Depends: fooish',
558+ 'Build-Depends-Indep: pyfoo',
559+ 'Build-Depends-Arch: libfoo-dev',
560+ 'Build-Conflicts: bar',
561+ 'Build-Conflicts-Indep: pybar',
562+ 'Build-Conflicts-Arch: libbar-dev',
563+ 'Architecture: all',
564+ 'Standards-Version: 3.6.2',
565+ 'Format: 1.0',
566+ 'Directory: pool/main/f/foo',
567+ 'Files:',
568+ ' %s 28 foo_666.dsc' % self.dsc_md5,
569+ 'Checksums-Sha1:',
570+ ' %s 28 foo_666.dsc' % self.dsc_sha1,
571+ 'Checksums-Sha256:',
572+ ' %s 28 foo_666.dsc' % self.dsc_sha256,
573 ],
574 build_spph_stanza(pub_source).makeOutput().splitlines())
575
576@@ -112,28 +114,28 @@
577 ("Build-Conflicts-Arch", "libbar-dev")])
578
579 self.assertEqual(
580- [u'Package: foo',
581- u'Binary: foo-bin',
582- u'Version: 666',
583- u'Section: base',
584- u'Maintainer: Foo Bar <foo@bar.com>',
585- u'Build-Depends: fooish',
586- u'Build-Depends-Indep: pyfoo',
587- u'Build-Depends-Arch: libfoo-dev',
588- u'Build-Conflicts: bar',
589- u'Build-Conflicts-Indep: pybar',
590- u'Build-Conflicts-Arch: libbar-dev',
591- u'Architecture: all',
592- u'Standards-Version: 3.6.2',
593- u'Format: 1.0',
594- u'Directory: pool/main/f/foo',
595- u'Files:',
596- u' %s 28 foo_666.dsc' % self.dsc_md5,
597- u'Checksums-Sha1:',
598- u' %s 28 foo_666.dsc' % self.dsc_sha1,
599- u'Checksums-Sha256:',
600- u' %s 28 foo_666.dsc' % self.dsc_sha256,
601- u'Python-Version: < 1.5'],
602+ ['Package: foo',
603+ 'Binary: foo-bin',
604+ 'Version: 666',
605+ 'Section: base',
606+ 'Maintainer: Foo Bar <foo@bar.com>',
607+ 'Build-Depends: fooish',
608+ 'Build-Depends-Indep: pyfoo',
609+ 'Build-Depends-Arch: libfoo-dev',
610+ 'Build-Conflicts: bar',
611+ 'Build-Conflicts-Indep: pybar',
612+ 'Build-Conflicts-Arch: libbar-dev',
613+ 'Architecture: all',
614+ 'Standards-Version: 3.6.2',
615+ 'Format: 1.0',
616+ 'Directory: pool/main/f/foo',
617+ 'Files:',
618+ ' %s 28 foo_666.dsc' % self.dsc_md5,
619+ 'Checksums-Sha1:',
620+ ' %s 28 foo_666.dsc' % self.dsc_sha1,
621+ 'Checksums-Sha256:',
622+ ' %s 28 foo_666.dsc' % self.dsc_sha256,
623+ 'Python-Version: < 1.5'],
624 build_spph_stanza(pub_source).makeOutput().splitlines())
625
626 def testBinaryStanza(self):
627@@ -149,32 +151,32 @@
628 phased_update_percentage=50)
629 pub_binary = pub_binaries[0]
630 self.assertEqual(
631- [u'Package: foo-bin',
632- u'Source: foo',
633- u'Priority: standard',
634- u'Section: base',
635- u'Installed-Size: 100',
636- u'Maintainer: Foo Bar <foo@bar.com>',
637- u'Architecture: all',
638- u'Version: 666',
639- u'Recommends: foo-dev',
640- u'Replaces: old-foo',
641- u'Suggests: pyfoo',
642- u'Provides: foo-master',
643- u'Depends: biscuit',
644- u'Conflicts: old-foo',
645- u'Pre-Depends: master-foo',
646- u'Enhances: foo-super',
647- u'Breaks: old-foo',
648- u'Filename: pool/main/f/foo/foo-bin_666_all.deb',
649- u'Size: 18',
650- u'MD5sum: ' + self.deb_md5,
651- u'SHA1: ' + self.deb_sha1,
652- u'SHA256: ' + self.deb_sha256,
653- u'Phased-Update-Percentage: 50',
654- u'Description: Foo app is great',
655- u' Well ...',
656- u' it does nothing, though'],
657+ ['Package: foo-bin',
658+ 'Source: foo',
659+ 'Priority: standard',
660+ 'Section: base',
661+ 'Installed-Size: 100',
662+ 'Maintainer: Foo Bar <foo@bar.com>',
663+ 'Architecture: all',
664+ 'Version: 666',
665+ 'Recommends: foo-dev',
666+ 'Replaces: old-foo',
667+ 'Suggests: pyfoo',
668+ 'Provides: foo-master',
669+ 'Depends: biscuit',
670+ 'Conflicts: old-foo',
671+ 'Pre-Depends: master-foo',
672+ 'Enhances: foo-super',
673+ 'Breaks: old-foo',
674+ 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
675+ 'Size: 18',
676+ 'MD5sum: ' + self.deb_md5,
677+ 'SHA1: ' + self.deb_sha1,
678+ 'SHA256: ' + self.deb_sha256,
679+ 'Phased-Update-Percentage: 50',
680+ 'Description: Foo app is great',
681+ ' Well ...',
682+ ' it does nothing, though'],
683 build_bpph_stanza(pub_binary).makeOutput().splitlines())
684
685 def testBinaryStanzaWithCustomFields(self):
686@@ -189,32 +191,32 @@
687 user_defined_fields=[("Python-Version", ">= 2.4")])
688 pub_binary = pub_binaries[0]
689 self.assertEqual(
690- [u'Package: foo-bin',
691- u'Source: foo',
692- u'Priority: standard',
693- u'Section: base',
694- u'Installed-Size: 100',
695- u'Maintainer: Foo Bar <foo@bar.com>',
696- u'Architecture: all',
697- u'Version: 666',
698- u'Recommends: foo-dev',
699- u'Replaces: old-foo',
700- u'Suggests: pyfoo',
701- u'Provides: foo-master',
702- u'Depends: biscuit',
703- u'Conflicts: old-foo',
704- u'Pre-Depends: master-foo',
705- u'Enhances: foo-super',
706- u'Breaks: old-foo',
707- u'Filename: pool/main/f/foo/foo-bin_666_all.deb',
708- u'Size: 18',
709- u'MD5sum: ' + self.deb_md5,
710- u'SHA1: ' + self.deb_sha1,
711- u'SHA256: ' + self.deb_sha256,
712- u'Description: Foo app is great',
713- u' Well ...',
714- u' it does nothing, though',
715- u'Python-Version: >= 2.4'],
716+ ['Package: foo-bin',
717+ 'Source: foo',
718+ 'Priority: standard',
719+ 'Section: base',
720+ 'Installed-Size: 100',
721+ 'Maintainer: Foo Bar <foo@bar.com>',
722+ 'Architecture: all',
723+ 'Version: 666',
724+ 'Recommends: foo-dev',
725+ 'Replaces: old-foo',
726+ 'Suggests: pyfoo',
727+ 'Provides: foo-master',
728+ 'Depends: biscuit',
729+ 'Conflicts: old-foo',
730+ 'Pre-Depends: master-foo',
731+ 'Enhances: foo-super',
732+ 'Breaks: old-foo',
733+ 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
734+ 'Size: 18',
735+ 'MD5sum: ' + self.deb_md5,
736+ 'SHA1: ' + self.deb_sha1,
737+ 'SHA256: ' + self.deb_sha256,
738+ 'Description: Foo app is great',
739+ ' Well ...',
740+ ' it does nothing, though',
741+ 'Python-Version: >= 2.4'],
742 build_bpph_stanza(pub_binary).makeOutput().splitlines())
743
744 def testBinaryStanzaDescription(self):
745@@ -245,26 +247,26 @@
746 description=description)[0]
747
748 self.assertEqual(
749- [u'Package: foo-bin',
750- u'Source: foo',
751- u'Priority: standard',
752- u'Section: base',
753- u'Installed-Size: 100',
754- u'Maintainer: Foo Bar <foo@bar.com>',
755- u'Architecture: all',
756- u'Version: 666',
757- u'Filename: pool/main/f/foo/foo-bin_666_all.deb',
758- u'Size: 18',
759- u'MD5sum: ' + self.deb_md5,
760- u'SHA1: ' + self.deb_sha1,
761- u'SHA256: ' + self.deb_sha256,
762- u'Description: Foo app is great',
763- u' Normal',
764- u' Normal',
765- u' .',
766- u' .',
767- u' .',
768- u' %s' % ('x' * 100),
769+ ['Package: foo-bin',
770+ 'Source: foo',
771+ 'Priority: standard',
772+ 'Section: base',
773+ 'Installed-Size: 100',
774+ 'Maintainer: Foo Bar <foo@bar.com>',
775+ 'Architecture: all',
776+ 'Version: 666',
777+ 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
778+ 'Size: 18',
779+ 'MD5sum: ' + self.deb_md5,
780+ 'SHA1: ' + self.deb_sha1,
781+ 'SHA256: ' + self.deb_sha256,
782+ 'Description: Foo app is great',
783+ ' Normal',
784+ ' Normal',
785+ ' .',
786+ ' .',
787+ ' .',
788+ ' %s' % ('x' * 100),
789 ],
790 build_bpph_stanza(pub_binary).makeOutput().splitlines())
791
792@@ -277,26 +279,26 @@
793 The encoding should be preserved and able to be encoded in
794 'utf-8' for disk writing.
795 """
796- description = u'Using non-ascii as: \xe7\xe3\xe9\xf3'
797+ description = 'Using non-ascii as: \xe7\xe3\xe9\xf3'
798 pub_binary = self.getPubBinaries(
799 description=description)[0]
800
801 self.assertEqual(
802- [u'Package: foo-bin',
803- u'Source: foo',
804- u'Priority: standard',
805- u'Section: base',
806- u'Installed-Size: 100',
807- u'Maintainer: Foo Bar <foo@bar.com>',
808- u'Architecture: all',
809- u'Version: 666',
810- u'Filename: pool/main/f/foo/foo-bin_666_all.deb',
811- u'Size: 18',
812- u'MD5sum: ' + self.deb_md5,
813- u'SHA1: ' + self.deb_sha1,
814- u'SHA256: ' + self.deb_sha256,
815- u'Description: Foo app is great',
816- u' Using non-ascii as: \xe7\xe3\xe9\xf3',
817+ ['Package: foo-bin',
818+ 'Source: foo',
819+ 'Priority: standard',
820+ 'Section: base',
821+ 'Installed-Size: 100',
822+ 'Maintainer: Foo Bar <foo@bar.com>',
823+ 'Architecture: all',
824+ 'Version: 666',
825+ 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
826+ 'Size: 18',
827+ 'MD5sum: ' + self.deb_md5,
828+ 'SHA1: ' + self.deb_sha1,
829+ 'SHA256: ' + self.deb_sha256,
830+ 'Description: Foo app is great',
831+ ' Using non-ascii as: \xe7\xe3\xe9\xf3',
832 ],
833 build_bpph_stanza(pub_binary).makeOutput().splitlines())
834
835@@ -315,7 +317,7 @@
836 pub_binary = self.getPubBinaries(
837 binaryname='foo-bin', pub_source=pub_source)[0]
838 self.assertEqual(
839- u'foo',
840+ 'foo',
841 get_field(build_bpph_stanza(pub_binary), 'Source'))
842
843 def testBinaryIncludesDifferingSourceVersion(self):
844@@ -324,7 +326,7 @@
845 pub_binary = self.getPubBinaries(
846 binaryname='foo', version='999', pub_source=pub_source)[0]
847 self.assertEqual(
848- u'foo (666)',
849+ 'foo (666)',
850 get_field(build_bpph_stanza(pub_binary), 'Source'))
851
852
853
854=== modified file 'lib/lp/archivepublisher/tests/test_pool.py'
855--- lib/lp/archivepublisher/tests/test_pool.py 2010-12-20 07:52:32 +0000
856+++ lib/lp/archivepublisher/tests/test_pool.py 2018-02-02 11:57:41 +0000
857@@ -1,8 +1,10 @@
858-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
859+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
860 # GNU Affero General Public License version 3 (see the file LICENSE).
861
862 """Tests for pool.py."""
863
864+from __future__ import absolute_import, print_function, unicode_literals
865+
866 __metaclass__ = type
867
868 import hashlib
869
870=== modified file 'lib/lp/archivepublisher/tests/test_processaccepted.py'
871--- lib/lp/archivepublisher/tests/test_processaccepted.py 2014-08-09 19:45:00 +0000
872+++ lib/lp/archivepublisher/tests/test_processaccepted.py 2018-02-02 11:57:41 +0000
873@@ -1,8 +1,10 @@
874-# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
875+# Copyright 2010-2018 Canonical Ltd. This software is licensed under the
876 # GNU Affero General Public License version 3 (see the file LICENSE).
877
878 """Test process-accepted.py"""
879
880+from __future__ import absolute_import, print_function, unicode_literals
881+
882 from optparse import OptionValueError
883
884 from testtools.matchers import LessThan
885@@ -35,7 +37,7 @@
886 TestCaseWithFactory.setUp(self)
887 self.stp = SoyuzTestPublisher()
888 self.stp.prepareBreezyAutotest()
889- self.test_package_name = u"accept-test"
890+ self.test_package_name = "accept-test"
891 self.distro = self.factory.makeDistribution()
892
893 def getScript(self, test_args=None):
894
895=== modified file 'lib/lp/archivepublisher/tests/test_processdeathrow.py'
896--- lib/lp/archivepublisher/tests/test_processdeathrow.py 2014-08-09 19:45:00 +0000
897+++ lib/lp/archivepublisher/tests/test_processdeathrow.py 2018-02-02 11:57:41 +0000
898@@ -1,4 +1,4 @@
899-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
900+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
901 # GNU Affero General Public License version 3 (see the file LICENSE).
902
903 """Functional tests for process-death-row.py script.
904@@ -8,6 +8,8 @@
905 processes its arguments and handles dry-run correctly.
906 """
907
908+from __future__ import absolute_import, print_function, unicode_literals
909+
910 __metaclass__ = type
911
912 import datetime
913@@ -105,12 +107,12 @@
914
915 cprov = getUtility(IPersonSet).getByName('cprov')
916 removeSecurityProxy(cprov.archive).distribution = ubuntutest
917- ppa_pubrecs = cprov.archive.getPublishedSources(u'iceweasel')
918+ ppa_pubrecs = cprov.archive.getPublishedSources('iceweasel')
919 self.ppa_pubrec_ids = self.markPublishingForRemoval(ppa_pubrecs)
920
921 mark = getUtility(IPersonSet).getByName('mark')
922 removeSecurityProxy(mark.archive).distribution = ubuntutest
923- ppa_pubrecs = mark.archive.getPublishedSources(u'iceweasel')
924+ ppa_pubrecs = mark.archive.getPublishedSources('iceweasel')
925 self.ppa_pubrec_ids.extend(self.markPublishingForRemoval(ppa_pubrecs))
926
927 # Fill one of the files in cprov PPA just to ensure that deathrow
928
929=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
930--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2016-12-05 22:16:25 +0000
931+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2018-02-02 11:57:41 +0000
932@@ -1,8 +1,10 @@
933-# Copyright 2011-2016 Canonical Ltd. This software is licensed under the
934+# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
935 # GNU Affero General Public License version 3 (see the file LICENSE).
936
937 """Test publish-ftpmaster cron script."""
938
939+from __future__ import absolute_import, print_function, unicode_literals
940+
941 __metaclass__ = type
942
943 import logging
944@@ -1306,7 +1308,7 @@
945 have_fresh_series = script.prepareFreshSeries(distro)
946 self.assertTrue(have_fresh_series)
947 [copied_upload] = new_series.getPackageUploads(
948- name=u'debian-installer-images', exact_match=False)
949+ name='debian-installer-images', exact_match=False)
950 [copied_custom] = copied_upload.customfiles
951 self.assertEqual(
952 custom_upload.customfiles[0].libraryfilealias.filename,
953
954=== modified file 'lib/lp/archivepublisher/tests/test_publishdistro.py'
955--- lib/lp/archivepublisher/tests/test_publishdistro.py 2017-04-29 15:24:32 +0000
956+++ lib/lp/archivepublisher/tests/test_publishdistro.py 2018-02-02 11:57:41 +0000
957@@ -1,8 +1,10 @@
958-# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
959+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
960 # GNU Affero General Public License version 3 (see the file LICENSE).
961
962 """Functional tests for publish-distro.py script."""
963
964+from __future__ import absolute_import, print_function, unicode_literals
965+
966 __metaclass__ = type
967
968 from optparse import OptionValueError
969
970=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
971--- lib/lp/archivepublisher/tests/test_publisher.py 2017-04-29 15:24:32 +0000
972+++ lib/lp/archivepublisher/tests/test_publisher.py 2018-02-02 11:57:41 +0000
973@@ -1,8 +1,10 @@
974-# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
975+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
976 # GNU Affero General Public License version 3 (see the file LICENSE).
977
978 """Tests for publisher class."""
979
980+from __future__ import absolute_import, print_function, unicode_literals
981+
982 __metaclass__ = type
983
984 import bz2
985@@ -450,7 +452,7 @@
986 for pu_build in pu_i386.builds:
987 pu_build.publish()
988
989- publications = archive.getAllPublishedBinaries(name=u"bin-i386")
990+ publications = archive.getAllPublishedBinaries(name="bin-i386")
991
992 self.assertEqual(1, publications.count())
993 self.assertEqual(
994@@ -809,14 +811,14 @@
995 self.assertFalse(os.path.exists(publisher._config.metaroot))
996 self.assertEqual(ArchiveStatus.DELETED, test_archive.status)
997 self.assertEqual(False, test_archive.publish)
998- self.assertEqual(u'testing-deletedppa', test_archive.name)
999+ self.assertEqual('testing-deletedppa', test_archive.name)
1000
1001 # All of the archive's active publications have been marked
1002 # DELETED, and dateremoved has been set early because they've
1003 # already been removed from disk.
1004 for pub in (spph, bpph, orphaned_bpph):
1005 self.assertEqual(PackagePublishingStatus.DELETED, pub.status)
1006- self.assertEqual(u'janitor', pub.removed_by.name)
1007+ self.assertEqual('janitor', pub.removed_by.name)
1008 self.assertIsNot(None, pub.dateremoved)
1009
1010 # The SUPERSEDED publications now have dateremoved set, even
1011@@ -1252,7 +1254,7 @@
1012 self.assertEqual(
1013 cprov.archive, archive_publisher.archive)
1014 self.assertEqual(
1015- u'/var/tmp/ppa.test/cprov/ppa/ubuntutest/dists',
1016+ '/var/tmp/ppa.test/cprov/ppa/ubuntutest/dists',
1017 archive_publisher._config.distsroot)
1018 self.assertEqual(
1019 [('breezy-autotest', PackagePublishingPocket.RELEASE)],
1020@@ -1933,7 +1935,7 @@
1021 """
1022 allowed_suites = []
1023 cprov = getUtility(IPersonSet).getByName('cprov')
1024- cprov.archive.displayname = u'PPA for Celso Provid\xe8lo'
1025+ cprov.archive.displayname = 'PPA for Celso Provid\xe8lo'
1026 archive_publisher = getPublisher(
1027 cprov.archive, allowed_suites, self.logger)
1028
1029@@ -1950,7 +1952,7 @@
1030 self.assertEqual('LP-PPA-cprov', release['origin'])
1031
1032 # The Label: field should be set to the archive displayname
1033- self.assertEqual(u'PPA for Celso Provid\xe8lo', release['label'])
1034+ self.assertEqual('PPA for Celso Provid\xe8lo', release['label'])
1035
1036 arch_sources_path = os.path.join(
1037 archive_publisher._config.distsroot, 'breezy-autotest',
1038@@ -2720,7 +2722,7 @@
1039 # A no-op run leaves the scheduled deletion date intact.
1040 i386_file = getUtility(IArchiveFileSet).getByArchive(
1041 self.ubuntutest.main_archive,
1042- path=u'dists/breezy-autotest/Contents-i386').one()
1043+ path='dists/breezy-autotest/Contents-i386').one()
1044 i386_date = i386_file.scheduled_deletion_date
1045 self.runSteps(publisher, step_d=True)
1046 flush_database_caches()
1047@@ -2746,7 +2748,7 @@
1048 # Arrange for the second file to be pruned.
1049 hppa_file = getUtility(IArchiveFileSet).getByArchive(
1050 self.ubuntutest.main_archive,
1051- path=u'dists/breezy-autotest/Contents-hppa').one()
1052+ path='dists/breezy-autotest/Contents-hppa').one()
1053 removeSecurityProxy(hppa_file).scheduled_deletion_date = (
1054 now - timedelta(hours=1))
1055 self.runSteps(publisher, step_d=True)
1056@@ -2809,7 +2811,7 @@
1057 ByHashHasContents(main_contents))
1058 archive_files = getUtility(IArchiveFileSet).getByArchive(
1059 self.ubuntutest.main_archive,
1060- path=u'dists/breezy-autotest/main/source/Sources')
1061+ path='dists/breezy-autotest/main/source/Sources')
1062 self.assertThat(
1063 sorted(archive_files, key=attrgetter('id')),
1064 MatchesListwise([
1065
1066=== modified file 'lib/lp/archivepublisher/tests/test_publisher_documentation.py'
1067--- lib/lp/archivepublisher/tests/test_publisher_documentation.py 2012-01-20 15:42:44 +0000
1068+++ lib/lp/archivepublisher/tests/test_publisher_documentation.py 2018-02-02 11:57:41 +0000
1069@@ -1,8 +1,10 @@
1070-# Copyright 2009 Canonical Ltd. This software is licensed under the
1071+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
1072 # GNU Affero General Public License version 3 (see the file LICENSE).
1073
1074 """Runs the archivepublisher doctests."""
1075
1076+from __future__ import absolute_import, print_function, unicode_literals
1077+
1078 __metaclass__ = type
1079
1080 import logging
1081
1082=== modified file 'lib/lp/archivepublisher/tests/test_publisherconfig.py'
1083--- lib/lp/archivepublisher/tests/test_publisherconfig.py 2013-06-20 05:50:00 +0000
1084+++ lib/lp/archivepublisher/tests/test_publisherconfig.py 2018-02-02 11:57:41 +0000
1085@@ -1,8 +1,10 @@
1086-# Copyright 2011 Canonical Ltd. This software is licensed under the
1087+# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
1088 # GNU Affero General Public License version 3 (see the file LICENSE).
1089
1090 """Tests for publisherConfig model class."""
1091
1092+from __future__ import absolute_import, print_function, unicode_literals
1093+
1094 __metaclass__ = type
1095
1096
1097@@ -45,9 +47,9 @@
1098
1099 def test_properties(self):
1100 # Test the model properties.
1101- ROOT_DIR = u"rootdir/test"
1102- BASE_URL = u"http://base.url"
1103- COPY_BASE_URL = u"http://base.url"
1104+ ROOT_DIR = "rootdir/test"
1105+ BASE_URL = "http://base.url"
1106+ COPY_BASE_URL = "http://base.url"
1107 pubconf = self.factory.makePublisherConfig(
1108 distribution=self.distribution,
1109 root_dir=ROOT_DIR,
1110@@ -83,7 +85,7 @@
1111
1112 def test_only_admin(self):
1113 # Only admins can see and change the config.
1114- distro = self.factory.makeDistribution(publish_root_dir=u"foo")
1115+ distro = self.factory.makeDistribution(publish_root_dir="foo")
1116 config = getUtility(IPublisherConfigSet).getByDistribution(distro)
1117
1118 login(ANONYMOUS)
1119@@ -91,6 +93,6 @@
1120 self.assertRaises(Unauthorized, setattr, config, "root_dir", "test")
1121
1122 login(LAUNCHPAD_ADMIN)
1123- self.assertEqual(u"foo", config.root_dir)
1124- config.root_dir = u"bar"
1125- self.assertEqual(u"bar", config.root_dir)
1126+ self.assertEqual("foo", config.root_dir)
1127+ config.root_dir = "bar"
1128+ self.assertEqual("bar", config.root_dir)
1129
1130=== modified file 'lib/lp/archivepublisher/tests/test_repositoryindexfile.py'
1131--- lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2016-10-04 01:27:20 +0000
1132+++ lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2018-02-02 11:57:41 +0000
1133@@ -1,8 +1,10 @@
1134-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
1135+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
1136 # GNU Affero General Public License version 3 (see the file LICENSE).
1137
1138 """Tests for `RepositoryIndexFile`."""
1139
1140+from __future__ import absolute_import, print_function, unicode_literals
1141+
1142 __metaclass__ = type
1143
1144 import bz2
1145
1146=== modified file 'lib/lp/archivepublisher/tests/test_rosetta_translations.py'
1147--- lib/lp/archivepublisher/tests/test_rosetta_translations.py 2016-05-23 10:14:39 +0000
1148+++ lib/lp/archivepublisher/tests/test_rosetta_translations.py 2018-02-02 11:57:41 +0000
1149@@ -1,4 +1,4 @@
1150-# Copyright 2013-2016 Canonical Ltd. This software is licensed under the
1151+# Copyright 2013-2018 Canonical Ltd. This software is licensed under the
1152 # GNU Affero General Public License version 3 (see the file LICENSE).
1153
1154 """Test rosetta-translations custom uploads.
1155@@ -7,6 +7,8 @@
1156 high-level tests of rosetta-translations upload and queue manipulation.
1157 """
1158
1159+from __future__ import absolute_import, print_function, unicode_literals
1160+
1161 from storm.expr import Desc
1162 import transaction
1163 from zope.component import getUtility
1164@@ -50,8 +52,8 @@
1165 """Create an LibraryFileAlias containing dummy translation data."""
1166 if tar_content is None:
1167 tar_content = {
1168- 'source/po/foo.pot': 'Foo template',
1169- 'source/po/eo.po': 'Foo translation',
1170+ 'source/po/foo.pot': b'Foo template',
1171+ 'source/po/eo.po': b'Foo translation',
1172 }
1173 tarfile_content = LaunchpadWriteTarFile.files_to_string(
1174 tar_content)
1175
1176=== modified file 'lib/lp/archivepublisher/tests/test_signing.py'
1177--- lib/lp/archivepublisher/tests/test_signing.py 2017-08-02 19:13:48 +0000
1178+++ lib/lp/archivepublisher/tests/test_signing.py 2018-02-02 11:57:41 +0000
1179@@ -1,8 +1,10 @@
1180-# Copyright 2012-2017 Canonical Ltd. This software is licensed under the
1181+# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
1182 # GNU Affero General Public License version 3 (see the file LICENSE).
1183
1184 """Test UEFI custom uploads."""
1185
1186+from __future__ import absolute_import, print_function, unicode_literals
1187+
1188 __metaclass__ = type
1189
1190 import os
1191@@ -255,9 +257,9 @@
1192 if not os.path.exists(pubconf.temproot):
1193 os.makedirs(pubconf.temproot)
1194 self.openArchive("test", "1.0", "amd64")
1195- self.tarfile.add_file("1.0/empty.efi", "")
1196- self.tarfile.add_file("1.0/empty.ko", "")
1197- self.tarfile.add_file("1.0/empty.opal", "")
1198+ self.tarfile.add_file("1.0/empty.efi", b"")
1199+ self.tarfile.add_file("1.0/empty.ko", b"")
1200+ self.tarfile.add_file("1.0/empty.opal", b"")
1201 upload = self.process_emulate()
1202 self.assertContentEqual([], upload.callLog.caller_list())
1203
1204@@ -265,9 +267,9 @@
1205 # If the configured key/cert are missing, processing succeeds but
1206 # nothing is signed.
1207 self.openArchive("test", "1.0", "amd64")
1208- self.tarfile.add_file("1.0/empty.efi", "")
1209- self.tarfile.add_file("1.0/empty.ko", "")
1210- self.tarfile.add_file("1.0/empty.opal", "")
1211+ self.tarfile.add_file("1.0/empty.efi", b"")
1212+ self.tarfile.add_file("1.0/empty.ko", b"")
1213+ self.tarfile.add_file("1.0/empty.opal", b"")
1214 upload = self.process_emulate()
1215 self.assertContentEqual([], upload.callLog.caller_list())
1216
1217@@ -277,9 +279,9 @@
1218 self.setUpUefiKeys()
1219 self.setUpKmodKeys()
1220 self.openArchive("test", "1.0", "amd64")
1221- self.tarfile.add_file("1.0/empty.efi", "")
1222- self.tarfile.add_file("1.0/empty.ko", "")
1223- self.tarfile.add_file("1.0/empty.opal", "")
1224+ self.tarfile.add_file("1.0/empty.efi", b"")
1225+ self.tarfile.add_file("1.0/empty.ko", b"")
1226+ self.tarfile.add_file("1.0/empty.opal", b"")
1227 upload = self.process_emulate()
1228 expected_callers = [
1229 ('UEFI signing', 1),
1230@@ -292,9 +294,9 @@
1231 # nothing is signed.
1232 self.setUpPPA()
1233 self.openArchive("test", "1.0", "amd64")
1234- self.tarfile.add_file("1.0/empty.efi", "")
1235- self.tarfile.add_file("1.0/empty.ko", "")
1236- self.tarfile.add_file("1.0/empty.opal", "")
1237+ self.tarfile.add_file("1.0/empty.efi", b"")
1238+ self.tarfile.add_file("1.0/empty.ko", b"")
1239+ self.tarfile.add_file("1.0/empty.opal", b"")
1240 upload = self.process_emulate()
1241 expected_callers = [
1242 ('UEFI keygen', 1),
1243@@ -352,7 +354,7 @@
1244 # If the configured key/cert are missing, processing succeeds but
1245 # nothing is signed.
1246 self.openArchive("test", "1.0", "amd64")
1247- self.tarfile.add_file("1.0/control/options", "")
1248+ self.tarfile.add_file("1.0/control/options", b"")
1249 upload = self.process_emulate()
1250 self.assertContentEqual([], upload.signing_options.keys())
1251
1252@@ -360,7 +362,7 @@
1253 # If the configured key/cert are missing, processing succeeds but
1254 # nothing is signed.
1255 self.openArchive("test", "1.0", "amd64")
1256- self.tarfile.add_file("1.0/control/options", "first\n")
1257+ self.tarfile.add_file("1.0/control/options", b"first\n")
1258 upload = self.process_emulate()
1259 self.assertContentEqual(['first'], upload.signing_options.keys())
1260
1261@@ -368,7 +370,7 @@
1262 # If the configured key/cert are missing, processing succeeds but
1263 # nothing is signed.
1264 self.openArchive("test", "1.0", "amd64")
1265- self.tarfile.add_file("1.0/control/options", "first\nsecond\n")
1266+ self.tarfile.add_file("1.0/control/options", b"first\nsecond\n")
1267 upload = self.process_emulate()
1268 self.assertContentEqual(['first', 'second'],
1269 upload.signing_options.keys())
1270@@ -379,9 +381,9 @@
1271 self.setUpKmodKeys()
1272 self.setUpOpalKeys()
1273 self.openArchive("test", "1.0", "amd64")
1274- self.tarfile.add_file("1.0/empty.efi", "")
1275- self.tarfile.add_file("1.0/empty.ko", "")
1276- self.tarfile.add_file("1.0/empty.opal", "")
1277+ self.tarfile.add_file("1.0/empty.efi", b"")
1278+ self.tarfile.add_file("1.0/empty.ko", b"")
1279+ self.tarfile.add_file("1.0/empty.opal", b"")
1280 self.process_emulate()
1281 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
1282 "1.0/SHA256SUMS",
1283@@ -397,10 +399,10 @@
1284 self.setUpKmodKeys()
1285 self.setUpOpalKeys()
1286 self.openArchive("test", "1.0", "amd64")
1287- self.tarfile.add_file("1.0/control/options", "tarball")
1288- self.tarfile.add_file("1.0/empty.efi", "")
1289- self.tarfile.add_file("1.0/empty.ko", "")
1290- self.tarfile.add_file("1.0/empty.opal", "")
1291+ self.tarfile.add_file("1.0/control/options", b"tarball")
1292+ self.tarfile.add_file("1.0/empty.efi", b"")
1293+ self.tarfile.add_file("1.0/empty.ko", b"")
1294+ self.tarfile.add_file("1.0/empty.opal", b"")
1295 self.process_emulate()
1296 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
1297 "1.0/SHA256SUMS",
1298@@ -425,10 +427,10 @@
1299 self.setUpKmodKeys()
1300 self.setUpOpalKeys()
1301 self.openArchive("test", "1.0", "amd64")
1302- self.tarfile.add_file("1.0/control/options", "signed-only")
1303- self.tarfile.add_file("1.0/empty.efi", "")
1304- self.tarfile.add_file("1.0/empty.ko", "")
1305- self.tarfile.add_file("1.0/empty.opal", "")
1306+ self.tarfile.add_file("1.0/control/options", b"signed-only")
1307+ self.tarfile.add_file("1.0/empty.efi", b"")
1308+ self.tarfile.add_file("1.0/empty.ko", b"")
1309+ self.tarfile.add_file("1.0/empty.opal", b"")
1310 self.process_emulate()
1311 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
1312 "1.0/SHA256SUMS", "1.0/control/options",
1313@@ -445,11 +447,10 @@
1314 self.setUpKmodKeys()
1315 self.setUpOpalKeys()
1316 self.openArchive("test", "1.0", "amd64")
1317- self.tarfile.add_file("1.0/control/options",
1318- "tarball\nsigned-only")
1319- self.tarfile.add_file("1.0/empty.efi", "")
1320- self.tarfile.add_file("1.0/empty.ko", "")
1321- self.tarfile.add_file("1.0/empty.opal", "")
1322+ self.tarfile.add_file("1.0/control/options", b"tarball\nsigned-only")
1323+ self.tarfile.add_file("1.0/empty.efi", b"")
1324+ self.tarfile.add_file("1.0/empty.ko", b"")
1325+ self.tarfile.add_file("1.0/empty.opal", b"")
1326 self.process_emulate()
1327 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
1328 "1.0/SHA256SUMS",
1329@@ -470,7 +471,7 @@
1330 # Nothing is signed.
1331 self.setUpUefiKeys()
1332 self.openArchive("empty", "1.0", "amd64")
1333- self.tarfile.add_file("1.0/hello", "world")
1334+ self.tarfile.add_file("1.0/hello", b"world")
1335 upload = self.process()
1336 self.assertTrue(os.path.exists(os.path.join(
1337 self.getSignedPath("empty", "amd64"), "1.0", "hello")))
1338@@ -481,7 +482,7 @@
1339 # If the target directory already exists, processing fails.
1340 self.setUpUefiKeys()
1341 self.openArchive("test", "1.0", "amd64")
1342- self.tarfile.add_file("1.0/empty.efi", "")
1343+ self.tarfile.add_file("1.0/empty.efi", b"")
1344 os.makedirs(os.path.join(self.getSignedPath("test", "amd64"), "1.0"))
1345 self.assertRaises(CustomUploadAlreadyExists, self.process)
1346
1347@@ -489,7 +490,7 @@
1348 # The umask must be 0o022 to avoid incorrect permissions.
1349 self.setUpUefiKeys()
1350 self.openArchive("test", "1.0", "amd64")
1351- self.tarfile.add_file("1.0/dir/file.efi", "foo")
1352+ self.tarfile.add_file("1.0/dir/file.efi", b"foo")
1353 os.umask(0o002) # cleanup already handled by setUp
1354 self.assertRaises(CustomUploadBadUmask, self.process)
1355
1356@@ -684,7 +685,7 @@
1357 # Each image in the tarball is signed.
1358 self.setUpUefiKeys()
1359 self.openArchive("test", "1.0", "amd64")
1360- self.tarfile.add_file("1.0/empty.efi", "")
1361+ self.tarfile.add_file("1.0/empty.efi", b"")
1362 upload = self.process()
1363 self.assertEqual(1, upload.signUefi.call_count)
1364
1365@@ -692,7 +693,7 @@
1366 # Each image in the tarball is signed.
1367 self.setUpKmodKeys()
1368 self.openArchive("test", "1.0", "amd64")
1369- self.tarfile.add_file("1.0/empty.ko", "")
1370+ self.tarfile.add_file("1.0/empty.ko", b"")
1371 upload = self.process()
1372 self.assertEqual(1, upload.signKmod.call_count)
1373
1374@@ -700,7 +701,7 @@
1375 # Each image in the tarball is signed.
1376 self.setUpOpalKeys()
1377 self.openArchive("test", "1.0", "amd64")
1378- self.tarfile.add_file("1.0/empty.opal", "")
1379+ self.tarfile.add_file("1.0/empty.opal", b"")
1380 upload = self.process()
1381 self.assertEqual(1, upload.signOpal.call_count)
1382
1383@@ -708,12 +709,12 @@
1384 # Each image in the tarball is signed.
1385 self.setUpKmodKeys()
1386 self.openArchive("test", "1.0", "amd64")
1387- self.tarfile.add_file("1.0/empty.efi", "")
1388- self.tarfile.add_file("1.0/empty.ko", "")
1389- self.tarfile.add_file("1.0/empty2.ko", "")
1390- self.tarfile.add_file("1.0/empty.opal", "")
1391- self.tarfile.add_file("1.0/empty2.opal", "")
1392- self.tarfile.add_file("1.0/empty3.opal", "")
1393+ self.tarfile.add_file("1.0/empty.efi", b"")
1394+ self.tarfile.add_file("1.0/empty.ko", b"")
1395+ self.tarfile.add_file("1.0/empty2.ko", b"")
1396+ self.tarfile.add_file("1.0/empty.opal", b"")
1397+ self.tarfile.add_file("1.0/empty2.opal", b"")
1398+ self.tarfile.add_file("1.0/empty3.opal", b"")
1399 upload = self.process()
1400 self.assertEqual(1, upload.signUefi.call_count)
1401 self.assertEqual(2, upload.signKmod.call_count)
1402@@ -723,7 +724,7 @@
1403 # Files in the tarball are installed correctly.
1404 self.setUpUefiKeys()
1405 self.openArchive("test", "1.0", "amd64")
1406- self.tarfile.add_file("1.0/empty.efi", "")
1407+ self.tarfile.add_file("1.0/empty.efi", b"")
1408 self.process()
1409 self.assertTrue(os.path.isdir(os.path.join(
1410 self.getDistsPath(), "signed")))
1411@@ -735,7 +736,7 @@
1412 os.makedirs(os.path.join(self.getDistsPath(), "uefi"))
1413 self.setUpUefiKeys()
1414 self.openArchive("test", "1.0", "amd64")
1415- self.tarfile.add_file("1.0/empty.efi", "")
1416+ self.tarfile.add_file("1.0/empty.efi", b"")
1417 self.process()
1418 self.assertTrue(os.path.isdir(os.path.join(
1419 self.getDistsPath(), "signed")))
1420@@ -747,7 +748,7 @@
1421 os.makedirs(os.path.join(self.getDistsPath(), "signing"))
1422 self.setUpUefiKeys()
1423 self.openArchive("test", "1.0", "amd64")
1424- self.tarfile.add_file("1.0/empty.efi", "")
1425+ self.tarfile.add_file("1.0/empty.efi", b"")
1426 self.process()
1427 self.assertTrue(os.path.isdir(os.path.join(
1428 self.getDistsPath(), "signed")))
1429@@ -870,9 +871,9 @@
1430 self.setUpKmodKeys()
1431 self.setUpOpalKeys()
1432 self.openArchive("test", "1.0", "amd64")
1433- self.tarfile.add_file("1.0/empty.efi", "")
1434- self.tarfile.add_file("1.0/empty.ko", "")
1435- self.tarfile.add_file("1.0/empty.opal", "")
1436+ self.tarfile.add_file("1.0/empty.efi", b"")
1437+ self.tarfile.add_file("1.0/empty.ko", b"")
1438+ self.tarfile.add_file("1.0/empty.opal", b"")
1439 self.process_emulate()
1440 sha256file = os.path.join(self.getSignedPath("test", "amd64"),
1441 "1.0", "SHA256SUMS")
1442@@ -888,9 +889,9 @@
1443 self.setUpKmodKeys()
1444 self.setUpOpalKeys()
1445 self.openArchive("test", "1.0", "amd64")
1446- self.tarfile.add_file("1.0/empty.efi", "")
1447- self.tarfile.add_file("1.0/empty.ko", "")
1448- self.tarfile.add_file("1.0/empty.opal", "")
1449+ self.tarfile.add_file("1.0/empty.efi", b"")
1450+ self.tarfile.add_file("1.0/empty.ko", b"")
1451+ self.tarfile.add_file("1.0/empty.opal", b"")
1452 self.process_emulate()
1453 sha256file = os.path.join(self.getSignedPath("test", "amd64"),
1454 "1.0", "SHA256SUMS")
1455@@ -907,10 +908,10 @@
1456 self.setUpKmodKeys()
1457 self.setUpOpalKeys()
1458 self.openArchive("test", "1.0", "amd64")
1459- self.tarfile.add_file("1.0/control/options", "tarball")
1460- self.tarfile.add_file("1.0/empty.efi", "")
1461- self.tarfile.add_file("1.0/empty.ko", "")
1462- self.tarfile.add_file("1.0/empty.opal", "")
1463+ self.tarfile.add_file("1.0/control/options", b"tarball")
1464+ self.tarfile.add_file("1.0/empty.efi", b"")
1465+ self.tarfile.add_file("1.0/empty.ko", b"")
1466+ self.tarfile.add_file("1.0/empty.opal", b"")
1467 self.process_emulate()
1468 sha256file = os.path.join(self.getSignedPath("test", "amd64"),
1469 "1.0", "SHA256SUMS")
1470@@ -951,7 +952,7 @@
1471 # Files in the tarball are installed correctly.
1472 self.setUpUefiKeys()
1473 self.openArchive("test", "1.0", "amd64")
1474- self.tarfile.add_file("1.0/empty.efi", "")
1475+ self.tarfile.add_file("1.0/empty.efi", b"")
1476 self.process()
1477 self.assertTrue(os.path.isdir(os.path.join(
1478 self.getDistsPath(), "uefi")))