Merge lp:~cjwatson/launchpad/soyuz-tests-future-imports into lp:launchpad
- soyuz-tests-future-imports
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 18550 |
Proposed branch: | lp:~cjwatson/launchpad/soyuz-tests-future-imports |
Merge into: | lp:launchpad |
Prerequisite: | lp:~cjwatson/launchpad/soyuz-browser-tests-future-imports |
Diff against target: |
1950 lines (+326/-235) 46 files modified
lib/lp/soyuz/tests/fakepackager.py (+3/-1) lib/lp/soyuz/tests/soyuz.py (+3/-1) lib/lp/soyuz/tests/test_archive.py (+56/-53) lib/lp/soyuz/tests/test_archive_agent.py (+3/-1) lib/lp/soyuz/tests/test_archive_privacy.py (+3/-1) lib/lp/soyuz/tests/test_archive_subscriptions.py (+3/-1) lib/lp/soyuz/tests/test_archivejob.py (+4/-2) lib/lp/soyuz/tests/test_archivesubscriptionview.py (+3/-1) lib/lp/soyuz/tests/test_binaryandsourcepackagename.py (+3/-1) lib/lp/soyuz/tests/test_binarypackagebuild.py (+26/-24) lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py (+4/-2) lib/lp/soyuz/tests/test_binarypackagename.py (+3/-1) lib/lp/soyuz/tests/test_binarypackagerelease.py (+3/-1) lib/lp/soyuz/tests/test_build.py (+3/-1) lib/lp/soyuz/tests/test_build_depwait.py (+5/-3) lib/lp/soyuz/tests/test_build_notify.py (+4/-2) lib/lp/soyuz/tests/test_build_privacy.py (+3/-1) lib/lp/soyuz/tests/test_build_set.py (+3/-1) lib/lp/soyuz/tests/test_build_start_estimation.py (+3/-1) lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py (+3/-1) lib/lp/soyuz/tests/test_distroseriesbinarypackage.py (+3/-1) lib/lp/soyuz/tests/test_distroseriesdifferencejob.py (+6/-4) lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py (+3/-1) lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py (+3/-1) lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py (+3/-1) lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py (+9/-7) lib/lp/soyuz/tests/test_doc.py (+3/-1) lib/lp/soyuz/tests/test_hasbuildrecords.py (+3/-1) lib/lp/soyuz/tests/test_initializedistroseriesjob.py (+11/-9) lib/lp/soyuz/tests/test_livefs.py (+16/-14) lib/lp/soyuz/tests/test_livefsbuild.py (+8/-6) lib/lp/soyuz/tests/test_livefsbuildbehaviour.py (+7/-5) lib/lp/soyuz/tests/test_packagecloner.py (+3/-1) lib/lp/soyuz/tests/test_packagecopyjob.py (+20/-18) lib/lp/soyuz/tests/test_packagediff.py (+2/-2) lib/lp/soyuz/tests/test_packagediffjob.py (+3/-1) lib/lp/soyuz/tests/test_packageset.py (+25/-23) lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py (+4/-2) lib/lp/soyuz/tests/test_packageupload.py (+6/-4) lib/lp/soyuz/tests/test_person_createppa.py (+3/-1) lib/lp/soyuz/tests/test_processacceptedbugsjob.py (+4/-2) lib/lp/soyuz/tests/test_publishing.py (+24/-22) lib/lp/soyuz/tests/test_publishing_models.py (+3/-1) lib/lp/soyuz/tests/test_sourcepackagerelease.py (+7/-5) lib/lp/soyuz/tests/test_vocabularies.py (+3/-1) lib/lp/soyuz/tests/test_yuitests.py (+3/-1) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/soyuz-tests-future-imports |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+337042@code.launchpad.net |
Commit message
Convert lp.soyuz.tests to Launchpad's preferred __future__ imports.
Description of the change
Long but boring. The only wart was needing to fix a couple of type(foo) == str checks.
To post a comment you must log in.
Revision history for this message
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/soyuz/tests/fakepackager.py' |
2 | --- lib/lp/soyuz/tests/fakepackager.py 2017-07-31 11:45:32 +0000 |
3 | +++ lib/lp/soyuz/tests/fakepackager.py 2018-02-02 10:33:11 +0000 |
4 | @@ -1,4 +1,4 @@ |
5 | -# Copyright 2009-2011 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 | """FakePackager utility. |
10 | @@ -7,6 +7,8 @@ |
11 | suite. |
12 | """ |
13 | |
14 | +from __future__ import absolute_import, print_function, unicode_literals |
15 | + |
16 | __metaclass__ = type |
17 | __all__ = ['FakePackager'] |
18 | |
19 | |
20 | === modified file 'lib/lp/soyuz/tests/soyuz.py' |
21 | --- lib/lp/soyuz/tests/soyuz.py 2017-06-14 02:44:33 +0000 |
22 | +++ lib/lp/soyuz/tests/soyuz.py 2018-02-02 10:33:11 +0000 |
23 | @@ -1,8 +1,10 @@ |
24 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
25 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
26 | # GNU Affero General Public License version 3 (see the file LICENSE). |
27 | |
28 | """Helper functions/classes for Soyuz tests.""" |
29 | |
30 | +from __future__ import absolute_import, print_function, unicode_literals |
31 | + |
32 | __metaclass__ = type |
33 | |
34 | __all__ = [ |
35 | |
36 | === modified file 'lib/lp/soyuz/tests/test_archive.py' |
37 | --- lib/lp/soyuz/tests/test_archive.py 2017-04-29 23:51:28 +0000 |
38 | +++ lib/lp/soyuz/tests/test_archive.py 2018-02-02 10:33:11 +0000 |
39 | @@ -1,8 +1,10 @@ |
40 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
41 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
42 | # GNU Affero General Public License version 3 (see the file LICENSE). |
43 | |
44 | """Test Archive features.""" |
45 | |
46 | +from __future__ import absolute_import, print_function, unicode_literals |
47 | + |
48 | from datetime import ( |
49 | date, |
50 | datetime, |
51 | @@ -12,6 +14,7 @@ |
52 | import os.path |
53 | |
54 | from pytz import UTC |
55 | +import six |
56 | from testtools.deferredruntest import AsynchronousDeferredRunTest |
57 | from testtools.matchers import ( |
58 | AllMatch, |
59 | @@ -1272,15 +1275,15 @@ |
60 | def test_feature_flag_disabled(self): |
61 | # With feature flag disabled, we will not create new named auth tokens. |
62 | private_ppa = self.factory.makeArchive(private=True) |
63 | - with FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u""}): |
64 | + with FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: ""}): |
65 | self.assertRaises(NamedAuthTokenFeatureDisabled, |
66 | - private_ppa.newNamedAuthToken, u"tokenname") |
67 | + private_ppa.newNamedAuthToken, "tokenname") |
68 | |
69 | def test_feature_flag_disabled_by_default(self): |
70 | # Without a feature flag, we will not create new named auth tokens. |
71 | private_ppa = self.factory.makeArchive(private=True) |
72 | self.assertRaises(NamedAuthTokenFeatureDisabled, |
73 | - private_ppa.newNamedAuthToken, u"tokenname") |
74 | + private_ppa.newNamedAuthToken, "tokenname") |
75 | |
76 | |
77 | class TestArchiveTokens(TestCaseWithFactory): |
78 | @@ -1292,7 +1295,7 @@ |
79 | self.private_ppa = self.factory.makeArchive(owner=owner, private=True) |
80 | self.joe = self.factory.makePerson(name='joe') |
81 | self.private_ppa.newSubscription(self.joe, owner) |
82 | - self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"})) |
83 | + self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"})) |
84 | |
85 | def test_getAuthToken_with_no_token(self): |
86 | self.assertIsNone(self.private_ppa.getAuthToken(self.joe)) |
87 | @@ -1308,8 +1311,8 @@ |
88 | self.assertEqual(token.archive_url, url) |
89 | |
90 | def test_newNamedAuthToken_private_archive(self): |
91 | - res = self.private_ppa.newNamedAuthToken(u"tokenname", as_dict=True) |
92 | - token = self.private_ppa.getNamedAuthToken(u"tokenname") |
93 | + res = self.private_ppa.newNamedAuthToken("tokenname", as_dict=True) |
94 | + token = self.private_ppa.getNamedAuthToken("tokenname") |
95 | self.assertIsNotNone(token) |
96 | self.assertIsNone(token.person) |
97 | self.assertEqual("tokenname", token.name) |
98 | @@ -1325,37 +1328,37 @@ |
99 | def test_newNamedAuthToken_public_archive(self): |
100 | public_ppa = self.factory.makeArchive(private=False) |
101 | self.assertRaises(ArchiveNotPrivate, |
102 | - public_ppa.newNamedAuthToken, u"tokenname") |
103 | + public_ppa.newNamedAuthToken, "tokenname") |
104 | |
105 | def test_newNamedAuthToken_duplicate_name(self): |
106 | - self.private_ppa.newNamedAuthToken(u"tokenname") |
107 | + self.private_ppa.newNamedAuthToken("tokenname") |
108 | self.assertRaises(DuplicateTokenName, |
109 | - self.private_ppa.newNamedAuthToken, u"tokenname") |
110 | + self.private_ppa.newNamedAuthToken, "tokenname") |
111 | |
112 | def test_newNamedAuthToken_with_custom_secret(self): |
113 | - token = self.private_ppa.newNamedAuthToken(u"tokenname", u"secret") |
114 | - self.assertEqual(u"secret", token.token) |
115 | + token = self.private_ppa.newNamedAuthToken("tokenname", "secret") |
116 | + self.assertEqual("secret", token.token) |
117 | |
118 | def test_newNamedAuthTokens_private_archive(self): |
119 | res = self.private_ppa.newNamedAuthTokens( |
120 | - (u"name1", u"name2"), as_dict=True) |
121 | + ("name1", "name2"), as_dict=True) |
122 | tokens = self.private_ppa.getNamedAuthTokens() |
123 | self.assertDictEqual({tok.name: tok.asDict() for tok in tokens}, res) |
124 | |
125 | def test_newNamedAuthTokens_public_archive(self): |
126 | public_ppa = self.factory.makeArchive(private=False) |
127 | self.assertRaises(ArchiveNotPrivate, |
128 | - public_ppa.newNamedAuthTokens, (u"name1", u"name2")) |
129 | + public_ppa.newNamedAuthTokens, ("name1", "name2")) |
130 | |
131 | def test_newNamedAuthTokens_duplicate_name(self): |
132 | - self.private_ppa.newNamedAuthToken(u"tok1") |
133 | + self.private_ppa.newNamedAuthToken("tok1") |
134 | res = self.private_ppa.newNamedAuthTokens( |
135 | - (u"tok1", u"tok2", u"tok3"), as_dict=True) |
136 | + ("tok1", "tok2", "tok3"), as_dict=True) |
137 | tokens = self.private_ppa.getNamedAuthTokens() |
138 | self.assertDictEqual({tok.name: tok.asDict() for tok in tokens}, res) |
139 | |
140 | def test_newNamedAuthTokens_idempotent(self): |
141 | - names = (u"name1", u"name2", u"name3", u"name4", u"name5") |
142 | + names = ("name1", "name2", "name3", "name4", "name5") |
143 | res1 = self.private_ppa.newNamedAuthTokens(names, as_dict=True) |
144 | res2 = self.private_ppa.newNamedAuthTokens(names, as_dict=True) |
145 | self.assertEqual(res1, res2) |
146 | @@ -1364,32 +1367,32 @@ |
147 | # Preload feature flag so it is cached. |
148 | getFeatureFlag(NAMED_AUTH_TOKEN_FEATURE_FLAG) |
149 | with StormStatementRecorder() as recorder1: |
150 | - self.private_ppa.newNamedAuthTokens((u"tok1")) |
151 | + self.private_ppa.newNamedAuthTokens(("tok1")) |
152 | with StormStatementRecorder() as recorder2: |
153 | - self.private_ppa.newNamedAuthTokens((u"tok1", u"tok2", u"tok3")) |
154 | + self.private_ppa.newNamedAuthTokens(("tok1", "tok2", "tok3")) |
155 | self.assertThat(recorder2, HasQueryCount.byEquality(recorder1)) |
156 | |
157 | def test_getNamedAuthToken_with_no_token(self): |
158 | self.assertRaises( |
159 | - NotFoundError, self.private_ppa.getNamedAuthToken, u"tokenname") |
160 | + NotFoundError, self.private_ppa.getNamedAuthToken, "tokenname") |
161 | |
162 | def test_getNamedAuthToken_with_token(self): |
163 | - res = self.private_ppa.newNamedAuthToken(u"tokenname", as_dict=True) |
164 | + res = self.private_ppa.newNamedAuthToken("tokenname", as_dict=True) |
165 | self.assertEqual( |
166 | - self.private_ppa.getNamedAuthToken(u"tokenname", as_dict=True), |
167 | + self.private_ppa.getNamedAuthToken("tokenname", as_dict=True), |
168 | res) |
169 | |
170 | def test_revokeNamedAuthToken_with_token(self): |
171 | - token = self.private_ppa.newNamedAuthToken(u"tokenname") |
172 | - self.private_ppa.revokeNamedAuthToken(u"tokenname") |
173 | + token = self.private_ppa.newNamedAuthToken("tokenname") |
174 | + self.private_ppa.revokeNamedAuthToken("tokenname") |
175 | self.assertIsNotNone(token.date_deactivated) |
176 | |
177 | def test_revokeNamedAuthToken_with_no_token(self): |
178 | self.assertRaises( |
179 | - NotFoundError, self.private_ppa.revokeNamedAuthToken, u"tokenname") |
180 | + NotFoundError, self.private_ppa.revokeNamedAuthToken, "tokenname") |
181 | |
182 | def test_revokeNamedAuthTokens(self): |
183 | - names = (u"name1", u"name2", u"name3", u"name4", u"name5") |
184 | + names = ("name1", "name2", "name3", "name4", "name5") |
185 | tokens = self.private_ppa.newNamedAuthTokens(names) |
186 | self.assertThat( |
187 | tokens, AllMatch(MatchesPredicate( |
188 | @@ -1400,10 +1403,10 @@ |
189 | lambda x: x.date_deactivated, '%s is active.'))) |
190 | |
191 | def test_revokeNamedAuthTokens_with_previously_revoked_token(self): |
192 | - names = (u"name1", u"name2", u"name3", u"name4", u"name5") |
193 | + names = ("name1", "name2", "name3", "name4", "name5") |
194 | self.private_ppa.newNamedAuthTokens(names) |
195 | - token1 = self.private_ppa.getNamedAuthToken(u"name1") |
196 | - token2 = self.private_ppa.getNamedAuthToken(u"name2") |
197 | + token1 = self.private_ppa.getNamedAuthToken("name1") |
198 | + token2 = self.private_ppa.getNamedAuthToken("name2") |
199 | |
200 | # Revoke token1. |
201 | deactivation_time_1 = datetime.now(UTC) - timedelta(seconds=90) |
202 | @@ -1417,34 +1420,34 @@ |
203 | self.assertLess(token1.date_deactivated, token2.date_deactivated) |
204 | |
205 | def test_revokeNamedAuthTokens_idempotent(self): |
206 | - names = (u"name1", u"name2", u"name3", u"name4", u"name5") |
207 | + names = ("name1", "name2", "name3", "name4", "name5") |
208 | res1 = self.private_ppa.revokeNamedAuthTokens(names) |
209 | res2 = self.private_ppa.revokeNamedAuthTokens(names) |
210 | self.assertEqual(res1, res2) |
211 | |
212 | def test_getNamedAuthToken_with_revoked_token(self): |
213 | - self.private_ppa.newNamedAuthToken(u"tokenname") |
214 | - self.private_ppa.revokeNamedAuthToken(u"tokenname") |
215 | + self.private_ppa.newNamedAuthToken("tokenname") |
216 | + self.private_ppa.revokeNamedAuthToken("tokenname") |
217 | self.assertRaises( |
218 | - NotFoundError, self.private_ppa.getNamedAuthToken, u"tokenname") |
219 | + NotFoundError, self.private_ppa.getNamedAuthToken, "tokenname") |
220 | |
221 | def test_getNamedAuthTokens(self): |
222 | - res1 = self.private_ppa.newNamedAuthToken(u"tokenname1", as_dict=True) |
223 | - res2 = self.private_ppa.newNamedAuthToken(u"tokenname2", as_dict=True) |
224 | - self.private_ppa.newNamedAuthToken(u"tokenname3") |
225 | - self.private_ppa.revokeNamedAuthToken(u"tokenname3") |
226 | + res1 = self.private_ppa.newNamedAuthToken("tokenname1", as_dict=True) |
227 | + res2 = self.private_ppa.newNamedAuthToken("tokenname2", as_dict=True) |
228 | + self.private_ppa.newNamedAuthToken("tokenname3") |
229 | + self.private_ppa.revokeNamedAuthToken("tokenname3") |
230 | self.assertContentEqual( |
231 | [res1, res2], |
232 | self.private_ppa.getNamedAuthTokens(as_dict=True)) |
233 | |
234 | def test_getNamedAuthTokens_with_names(self): |
235 | - res1 = self.private_ppa.newNamedAuthToken(u"tokenname1", as_dict=True) |
236 | - res2 = self.private_ppa.newNamedAuthToken(u"tokenname2", as_dict=True) |
237 | - self.private_ppa.newNamedAuthToken(u"tokenname3") |
238 | + res1 = self.private_ppa.newNamedAuthToken("tokenname1", as_dict=True) |
239 | + res2 = self.private_ppa.newNamedAuthToken("tokenname2", as_dict=True) |
240 | + self.private_ppa.newNamedAuthToken("tokenname3") |
241 | self.assertContentEqual( |
242 | [res1, res2], |
243 | self.private_ppa.getNamedAuthTokens( |
244 | - (u"tokenname1", u"tokenname2"), as_dict=True)) |
245 | + ("tokenname1", "tokenname2"), as_dict=True)) |
246 | |
247 | |
248 | class TestGetBinaryPackageRelease(TestCaseWithFactory): |
249 | @@ -1970,14 +1973,14 @@ |
250 | def _createDep(self, test_publisher, derived_series, parent_series, |
251 | parent_distro, component_name=None, pocket=None, |
252 | overlay=True, arch_tag='i386', |
253 | - publish_base_url=u'http://archive.launchpad.dev/'): |
254 | + publish_base_url='http://archive.launchpad.dev/'): |
255 | # Helper to create a parent/child relationship. |
256 | - if type(parent_distro) == str: |
257 | + if isinstance(parent_distro, six.string_types): |
258 | depdistro = self.factory.makeDistribution(parent_distro, |
259 | publish_base_url=publish_base_url) |
260 | else: |
261 | depdistro = parent_distro |
262 | - if type(parent_series) == str: |
263 | + if isinstance(parent_series, six.string_types): |
264 | depseries = self.factory.makeDistroSeries( |
265 | name=parent_series, distribution=depdistro) |
266 | self.factory.makeDistroArchSeries( |
267 | @@ -2454,20 +2457,20 @@ |
268 | found.append((title, pub_ds)) |
269 | self.assertEqual(expected, found) |
270 | self.assertEqual(1, |
271 | - cprov_archive.getPublishedSources(name=u'cd').count()) |
272 | + cprov_archive.getPublishedSources(name='cd').count()) |
273 | self.assertEqual(1, |
274 | - cprov_archive.getPublishedSources(name=u'ice').count()) |
275 | + cprov_archive.getPublishedSources(name='ice').count()) |
276 | self.assertEqual(1, cprov_archive.getPublishedSources( |
277 | - name=u'iceweasel', exact_match=True).count()) |
278 | + name='iceweasel', exact_match=True).count()) |
279 | self.assertEqual(0, cprov_archive.getPublishedSources( |
280 | - name=u'ice', exact_match=True).count()) |
281 | + name='ice', exact_match=True).count()) |
282 | self.assertRaises(VersionRequiresName, |
283 | cprov_archive.getPublishedSources, |
284 | version='1.0') |
285 | self.assertEqual(1, cprov_archive.getPublishedSources( |
286 | - name=u'ice', version='1.0').count()) |
287 | + name='ice', version='1.0').count()) |
288 | self.assertEqual(0, cprov_archive.getPublishedSources( |
289 | - name=u'ice', version='666').count()) |
290 | + name='ice', version='666').count()) |
291 | self.assertEqual(3, cprov_archive.getPublishedSources( |
292 | status=PackagePublishingStatus.PUBLISHED).count()) |
293 | self.assertEqual(3, cprov_archive.getPublishedSources( |
294 | @@ -2487,9 +2490,9 @@ |
295 | distroseries=warty, |
296 | pocket=PackagePublishingPocket.UPDATES).count()) |
297 | self.assertEqual(1, cprov_archive.getPublishedSources( |
298 | - name=u'ice', distroseries=warty).count()) |
299 | + name='ice', distroseries=warty).count()) |
300 | self.assertEqual(0, cprov_archive.getPublishedSources( |
301 | - name=u'ice', distroseries=breezy_autotest).count()) |
302 | + name='ice', distroseries=breezy_autotest).count()) |
303 | mid_2007 = datetime(year=2007, month=7, day=9, hour=14, tzinfo=UTC) |
304 | self.assertEqual(0, cprov_archive.getPublishedSources( |
305 | created_since_date=mid_2007).count()) |
306 | @@ -3383,7 +3386,7 @@ |
307 | self.assertIs( |
308 | None, |
309 | self.set.getPPAOwnedByPerson( |
310 | - archive.owner, archive.distribution, archive.name + u'lol')) |
311 | + archive.owner, archive.distribution, archive.name + 'lol')) |
312 | self.assertIs( |
313 | None, |
314 | self.set.getPPAOwnedByPerson( |
315 | |
316 | === modified file 'lib/lp/soyuz/tests/test_archive_agent.py' |
317 | --- lib/lp/soyuz/tests/test_archive_agent.py 2014-03-11 07:08:33 +0000 |
318 | +++ lib/lp/soyuz/tests/test_archive_agent.py 2018-02-02 10:33:11 +0000 |
319 | @@ -1,8 +1,10 @@ |
320 | -# Copyright 2010-2012 Canonical Ltd. This software is licensed under the GNU |
321 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the GNU |
322 | # Affero General Public License version 3 (see the file LICENSE). |
323 | |
324 | """Test Archive software center agent celebrity.""" |
325 | |
326 | +from __future__ import absolute_import, print_function, unicode_literals |
327 | + |
328 | from zope.component import getUtility |
329 | from zope.security.interfaces import Unauthorized |
330 | |
331 | |
332 | === modified file 'lib/lp/soyuz/tests/test_archive_privacy.py' |
333 | --- lib/lp/soyuz/tests/test_archive_privacy.py 2013-05-10 05:30:11 +0000 |
334 | +++ lib/lp/soyuz/tests/test_archive_privacy.py 2018-02-02 10:33:11 +0000 |
335 | @@ -1,8 +1,10 @@ |
336 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
337 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
338 | # GNU Affero General Public License version 3 (see the file LICENSE). |
339 | |
340 | """Test Archive privacy features.""" |
341 | |
342 | +from __future__ import absolute_import, print_function, unicode_literals |
343 | + |
344 | from zope.security.interfaces import Unauthorized |
345 | |
346 | from lp.soyuz.interfaces.archive import CannotSwitchPrivacy |
347 | |
348 | === modified file 'lib/lp/soyuz/tests/test_archive_subscriptions.py' |
349 | --- lib/lp/soyuz/tests/test_archive_subscriptions.py 2016-03-17 23:40:28 +0000 |
350 | +++ lib/lp/soyuz/tests/test_archive_subscriptions.py 2018-02-02 10:33:11 +0000 |
351 | @@ -1,8 +1,10 @@ |
352 | -# Copyright 2009-2013 Canonical Ltd. This software is licensed under the |
353 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
354 | # GNU Affero General Public License version 3 (see the file LICENSE). |
355 | |
356 | """Test Archive features.""" |
357 | |
358 | +from __future__ import absolute_import, print_function, unicode_literals |
359 | + |
360 | from fixtures import FakeLogger |
361 | from storm.store import Store |
362 | from testtools.matchers import Equals |
363 | |
364 | === modified file 'lib/lp/soyuz/tests/test_archivejob.py' |
365 | --- lib/lp/soyuz/tests/test_archivejob.py 2017-01-14 00:17:26 +0000 |
366 | +++ lib/lp/soyuz/tests/test_archivejob.py 2018-02-02 10:33:11 +0000 |
367 | @@ -1,6 +1,8 @@ |
368 | -# Copyright 2010-2017 Canonical Ltd. This software is licensed under the |
369 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
370 | # GNU Affero General Public License version 3 (see the file LICENSE). |
371 | |
372 | +from __future__ import absolute_import, print_function, unicode_literals |
373 | + |
374 | from debian.deb822 import Changes |
375 | |
376 | from lp.services.job.runner import JobRunner |
377 | @@ -43,7 +45,7 @@ |
378 | # deserialized from JSON, so the representation returned by |
379 | # archive_job.metadata will be different from what we originally |
380 | # passed in. |
381 | - metadata_expected = (u'some', u'arbitrary', u'metadata') |
382 | + metadata_expected = ('some', 'arbitrary', 'metadata') |
383 | self.assertEqual(metadata_expected, archive_job.metadata) |
384 | |
385 | |
386 | |
387 | === modified file 'lib/lp/soyuz/tests/test_archivesubscriptionview.py' |
388 | --- lib/lp/soyuz/tests/test_archivesubscriptionview.py 2012-01-26 13:36:20 +0000 |
389 | +++ lib/lp/soyuz/tests/test_archivesubscriptionview.py 2018-02-02 10:33:11 +0000 |
390 | @@ -1,8 +1,10 @@ |
391 | -# Copyright 2012 Canonical Ltd. This software is licensed under the |
392 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
393 | # GNU Affero General Public License version 3 (see the file LICENSE). |
394 | |
395 | """Unit tests for ArchiveSubscribersView.""" |
396 | |
397 | +from __future__ import absolute_import, print_function, unicode_literals |
398 | + |
399 | __metaclass__ = type |
400 | |
401 | from soupmatchers import ( |
402 | |
403 | === modified file 'lib/lp/soyuz/tests/test_binaryandsourcepackagename.py' |
404 | --- lib/lp/soyuz/tests/test_binaryandsourcepackagename.py 2012-01-01 02:58:52 +0000 |
405 | +++ lib/lp/soyuz/tests/test_binaryandsourcepackagename.py 2018-02-02 10:33:11 +0000 |
406 | @@ -1,8 +1,10 @@ |
407 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
408 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
409 | # GNU Affero General Public License version 3 (see the file LICENSE). |
410 | |
411 | """Test the binary and source package name vocabularies.""" |
412 | |
413 | +from __future__ import absolute_import, print_function, unicode_literals |
414 | + |
415 | __metaclass__ = type |
416 | |
417 | from storm.store import Store |
418 | |
419 | === modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py' |
420 | --- lib/lp/soyuz/tests/test_binarypackagebuild.py 2016-01-06 12:24:47 +0000 |
421 | +++ lib/lp/soyuz/tests/test_binarypackagebuild.py 2018-02-02 10:33:11 +0000 |
422 | @@ -1,8 +1,10 @@ |
423 | -# Copyright 2009-2016 Canonical Ltd. This software is licensed under the |
424 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
425 | # GNU Affero General Public License version 3 (see the file LICENSE). |
426 | |
427 | """Test Build features.""" |
428 | |
429 | +from __future__ import absolute_import, print_function, unicode_literals |
430 | + |
431 | from datetime import ( |
432 | datetime, |
433 | timedelta, |
434 | @@ -229,7 +231,7 @@ |
435 | [depwait_build] = depwait_source.createMissingBuilds() |
436 | depwait_build.updateStatus( |
437 | BuildStatus.MANUALDEPWAIT, |
438 | - slave_status={'dependencies': u'dep-bin'}) |
439 | + slave_status={'dependencies': 'dep-bin'}) |
440 | return depwait_build |
441 | |
442 | def testUpdateDependenciesWorks(self): |
443 | @@ -257,13 +259,13 @@ |
444 | self.assertRaisesUnparsableDependencies(depwait_build, None) |
445 | |
446 | # Missing 'name'. |
447 | - self.assertRaisesUnparsableDependencies(depwait_build, u'(>> version)') |
448 | + self.assertRaisesUnparsableDependencies(depwait_build, '(>> version)') |
449 | |
450 | # Missing 'version'. |
451 | - self.assertRaisesUnparsableDependencies(depwait_build, u'name (>>)') |
452 | + self.assertRaisesUnparsableDependencies(depwait_build, 'name (>>)') |
453 | |
454 | # Missing comma between dependencies. |
455 | - self.assertRaisesUnparsableDependencies(depwait_build, u'name1 name2') |
456 | + self.assertRaisesUnparsableDependencies(depwait_build, 'name1 name2') |
457 | |
458 | def testBug378828(self): |
459 | # `IBinaryPackageBuild.updateDependencies` copes with the |
460 | @@ -293,14 +295,14 @@ |
461 | |
462 | depwait_build.updateStatus( |
463 | BuildStatus.MANUALDEPWAIT, |
464 | - slave_status={'dependencies': u'dep-bin (>> 666)'}) |
465 | + slave_status={'dependencies': 'dep-bin (>> 666)'}) |
466 | depwait_build.updateDependencies() |
467 | - self.assertEqual(depwait_build.dependencies, u'dep-bin (>> 666)') |
468 | + self.assertEqual(depwait_build.dependencies, 'dep-bin (>> 666)') |
469 | depwait_build.updateStatus( |
470 | BuildStatus.MANUALDEPWAIT, |
471 | - slave_status={'dependencies': u'dep-bin (>= 666)'}) |
472 | + slave_status={'dependencies': 'dep-bin (>= 666)'}) |
473 | depwait_build.updateDependencies() |
474 | - self.assertEqual(depwait_build.dependencies, u'') |
475 | + self.assertEqual(depwait_build.dependencies, '') |
476 | |
477 | def testVersionedDependencyOnOldPublication(self): |
478 | # `IBinaryPackageBuild.updateDependencies` doesn't just consider |
479 | @@ -316,24 +318,24 @@ |
480 | |
481 | depwait_build.updateStatus( |
482 | BuildStatus.MANUALDEPWAIT, |
483 | - slave_status={'dependencies': u'dep-bin (= 666)'}) |
484 | + slave_status={'dependencies': 'dep-bin (= 666)'}) |
485 | depwait_build.updateDependencies() |
486 | - self.assertEqual(depwait_build.dependencies, u'') |
487 | + self.assertEqual(depwait_build.dependencies, '') |
488 | depwait_build.updateStatus( |
489 | BuildStatus.MANUALDEPWAIT, |
490 | - slave_status={'dependencies': u'dep-bin (= 999)'}) |
491 | + slave_status={'dependencies': 'dep-bin (= 999)'}) |
492 | depwait_build.updateDependencies() |
493 | - self.assertEqual(depwait_build.dependencies, u'') |
494 | + self.assertEqual(depwait_build.dependencies, '') |
495 | |
496 | def testStrictInequalities(self): |
497 | depwait_build = self._setupSimpleDepwaitContext() |
498 | self.layer.txn.commit() |
499 | |
500 | for dep, expected in ( |
501 | - (u'dep-bin (<< 444)', u'dep-bin (<< 444)'), |
502 | - (u'dep-bin (>> 444)', u''), |
503 | - (u'dep-bin (<< 888)', u''), |
504 | - (u'dep-bin (>> 888)', u'dep-bin (>> 888)'), |
505 | + ('dep-bin (<< 444)', 'dep-bin (<< 444)'), |
506 | + ('dep-bin (>> 444)', ''), |
507 | + ('dep-bin (<< 888)', ''), |
508 | + ('dep-bin (>> 888)', 'dep-bin (>> 888)'), |
509 | ): |
510 | depwait_build.updateStatus( |
511 | BuildStatus.MANUALDEPWAIT, slave_status={'dependencies': dep}) |
512 | @@ -349,10 +351,10 @@ |
513 | depwait_build.updateStatus( |
514 | BuildStatus.MANUALDEPWAIT, |
515 | slave_status={ |
516 | - 'dependencies': u'dep-bin (>= 999) | alt-bin, dep-tools'}) |
517 | + 'dependencies': 'dep-bin (>= 999) | alt-bin, dep-tools'}) |
518 | depwait_build.updateDependencies() |
519 | self.assertEqual( |
520 | - u'dep-bin (>= 999) | alt-bin, dep-tools', |
521 | + 'dep-bin (>= 999) | alt-bin, dep-tools', |
522 | depwait_build.dependencies) |
523 | |
524 | self.publisher.getPubBinaries( |
525 | @@ -360,7 +362,7 @@ |
526 | self.layer.txn.commit() |
527 | |
528 | depwait_build.updateDependencies() |
529 | - self.assertEqual(u'dep-tools', depwait_build.dependencies) |
530 | + self.assertEqual('dep-tools', depwait_build.dependencies) |
531 | |
532 | def testAptVersionConstraints(self): |
533 | # launchpad-buildd can return apt-style version constraints |
534 | @@ -370,14 +372,14 @@ |
535 | |
536 | depwait_build.updateStatus( |
537 | BuildStatus.MANUALDEPWAIT, |
538 | - slave_status={'dependencies': u'dep-bin (> 666), dep-bin (< 777)'}) |
539 | + slave_status={'dependencies': 'dep-bin (> 666), dep-bin (< 777)'}) |
540 | depwait_build.updateDependencies() |
541 | - self.assertEqual(depwait_build.dependencies, u'dep-bin (> 666)') |
542 | + self.assertEqual(depwait_build.dependencies, 'dep-bin (> 666)') |
543 | depwait_build.updateStatus( |
544 | BuildStatus.MANUALDEPWAIT, |
545 | - slave_status={'dependencies': u'dep-bin (> 665)'}) |
546 | + slave_status={'dependencies': 'dep-bin (> 665)'}) |
547 | depwait_build.updateDependencies() |
548 | - self.assertEqual(depwait_build.dependencies, u'') |
549 | + self.assertEqual(depwait_build.dependencies, '') |
550 | |
551 | |
552 | class BaseTestCaseWithThreeBuilds(TestCaseWithFactory): |
553 | |
554 | === modified file 'lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py' |
555 | --- lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py 2017-07-26 13:21:25 +0000 |
556 | +++ lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py 2018-02-02 10:33:11 +0000 |
557 | @@ -1,8 +1,10 @@ |
558 | -# Copyright 2010-2017 Canonical Ltd. This software is licensed under the |
559 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
560 | # GNU Affero General Public License version 3 (see the file LICENSE). |
561 | |
562 | """Tests for BinaryPackageBuildBehaviour.""" |
563 | |
564 | +from __future__ import absolute_import, print_function, unicode_literals |
565 | + |
566 | __metaclass__ = type |
567 | |
568 | import gzip |
569 | @@ -258,7 +260,7 @@ |
570 | interactor.getBuildBehaviour(bq, builder, slave), BufferLogger()) |
571 | yield self.assertExpectedInteraction( |
572 | slave.call_log, builder, build, lf, archive, ArchivePurpose.PPA, |
573 | - extra_uploads=[(sprf_url, 'buildd', u'sekrit')], |
574 | + extra_uploads=[(sprf_url, 'buildd', 'sekrit')], |
575 | filemap_names=[sprf.libraryfile.filename]) |
576 | |
577 | @defer.inlineCallbacks |
578 | |
579 | === modified file 'lib/lp/soyuz/tests/test_binarypackagename.py' |
580 | --- lib/lp/soyuz/tests/test_binarypackagename.py 2016-06-10 09:26:31 +0000 |
581 | +++ lib/lp/soyuz/tests/test_binarypackagename.py 2018-02-02 10:33:11 +0000 |
582 | @@ -1,8 +1,10 @@ |
583 | -# Copyright 2010-2016 Canonical Ltd. This software is licensed under the |
584 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
585 | # GNU Affero General Public License version 3 (see the file LICENSE). |
586 | |
587 | """Test BinaryPackageName.""" |
588 | |
589 | +from __future__ import absolute_import, print_function, unicode_literals |
590 | + |
591 | __metaclass__ = type |
592 | |
593 | from zope.component import getUtility |
594 | |
595 | === modified file 'lib/lp/soyuz/tests/test_binarypackagerelease.py' |
596 | --- lib/lp/soyuz/tests/test_binarypackagerelease.py 2018-01-02 16:10:26 +0000 |
597 | +++ lib/lp/soyuz/tests/test_binarypackagerelease.py 2018-02-02 10:33:11 +0000 |
598 | @@ -1,8 +1,10 @@ |
599 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
600 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
601 | # GNU Affero General Public License version 3 (see the file LICENSE). |
602 | |
603 | """Test BinaryPackageRelease.""" |
604 | |
605 | +from __future__ import absolute_import, print_function, unicode_literals |
606 | + |
607 | __metaclass__ = type |
608 | |
609 | from lp.soyuz.enums import BinaryPackageFormat |
610 | |
611 | === modified file 'lib/lp/soyuz/tests/test_build.py' |
612 | --- lib/lp/soyuz/tests/test_build.py 2018-01-02 16:10:26 +0000 |
613 | +++ lib/lp/soyuz/tests/test_build.py 2018-02-02 10:33:11 +0000 |
614 | @@ -1,6 +1,8 @@ |
615 | -# Copyright 2011-2016 Canonical Ltd. This software is licensed under the |
616 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
617 | # GNU Affero General Public License version 3 (see the file LICENSE). |
618 | |
619 | +from __future__ import absolute_import, print_function, unicode_literals |
620 | + |
621 | __metaclass__ = type |
622 | |
623 | from datetime import ( |
624 | |
625 | === modified file 'lib/lp/soyuz/tests/test_build_depwait.py' |
626 | --- lib/lp/soyuz/tests/test_build_depwait.py 2018-01-02 16:10:26 +0000 |
627 | +++ lib/lp/soyuz/tests/test_build_depwait.py 2018-02-02 10:33:11 +0000 |
628 | @@ -1,6 +1,8 @@ |
629 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
630 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
631 | # GNU Affero General Public License version 3 (see the file LICENSE). |
632 | |
633 | +from __future__ import absolute_import, print_function, unicode_literals |
634 | + |
635 | __metaclass__ = type |
636 | |
637 | import transaction |
638 | @@ -67,7 +69,7 @@ |
639 | # Commit to make sure stuff hits the database. |
640 | transaction.commit() |
641 | build.updateDependencies() |
642 | - self.assertEqual(u'', build.dependencies) |
643 | + self.assertEqual('', build.dependencies) |
644 | |
645 | def test_update_dependancies_respects_component(self): |
646 | # Since main can only utilise packages that are published in main, |
647 | @@ -98,4 +100,4 @@ |
648 | transaction.commit() |
649 | # Now that we have moved it main, we can see it. |
650 | build.updateDependencies() |
651 | - self.assertEqual(u'', build.dependencies) |
652 | + self.assertEqual('', build.dependencies) |
653 | |
654 | === modified file 'lib/lp/soyuz/tests/test_build_notify.py' |
655 | --- lib/lp/soyuz/tests/test_build_notify.py 2016-12-22 16:32:38 +0000 |
656 | +++ lib/lp/soyuz/tests/test_build_notify.py 2018-02-02 10:33:11 +0000 |
657 | @@ -1,6 +1,8 @@ |
658 | -# Copyright 2011-2016 Canonical Ltd. This software is licensed under the |
659 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
660 | # GNU Affero General Public License version 3 (see the file LICENSE). |
661 | |
662 | +from __future__ import absolute_import, print_function, unicode_literals |
663 | + |
664 | __metaclass__ = type |
665 | |
666 | from datetime import timedelta |
667 | @@ -127,7 +129,7 @@ |
668 | build.status.name, notification['X-Launchpad-Build-State']) |
669 | self.assertEqual( |
670 | build.archive.reference, notification['X-Launchpad-Archive']) |
671 | - if ppa and build.archive.distribution.name == u'ubuntu': |
672 | + if ppa and build.archive.distribution.name == 'ubuntu': |
673 | self.assertEqual( |
674 | get_ppa_reference(self.ppa), notification['X-Launchpad-PPA']) |
675 | body = notification.get_payload(decode=True) |
676 | |
677 | === modified file 'lib/lp/soyuz/tests/test_build_privacy.py' |
678 | --- lib/lp/soyuz/tests/test_build_privacy.py 2018-01-02 16:10:26 +0000 |
679 | +++ lib/lp/soyuz/tests/test_build_privacy.py 2018-02-02 10:33:11 +0000 |
680 | @@ -1,6 +1,8 @@ |
681 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
682 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
683 | # GNU Affero General Public License version 3 (see the file LICENSE). |
684 | |
685 | +from __future__ import absolute_import, print_function, unicode_literals |
686 | + |
687 | __metaclass__ = type |
688 | |
689 | from zope.component import getUtility |
690 | |
691 | === modified file 'lib/lp/soyuz/tests/test_build_set.py' |
692 | --- lib/lp/soyuz/tests/test_build_set.py 2018-01-02 16:10:26 +0000 |
693 | +++ lib/lp/soyuz/tests/test_build_set.py 2018-02-02 10:33:11 +0000 |
694 | @@ -1,6 +1,8 @@ |
695 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
696 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
697 | # GNU Affero General Public License version 3 (see the file LICENSE). |
698 | |
699 | +from __future__ import absolute_import, print_function, unicode_literals |
700 | + |
701 | __metaclass__ = type |
702 | |
703 | from zope.component import getUtility |
704 | |
705 | === modified file 'lib/lp/soyuz/tests/test_build_start_estimation.py' |
706 | --- lib/lp/soyuz/tests/test_build_start_estimation.py 2018-01-02 16:10:26 +0000 |
707 | +++ lib/lp/soyuz/tests/test_build_start_estimation.py 2018-02-02 10:33:11 +0000 |
708 | @@ -1,6 +1,8 @@ |
709 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
710 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
711 | # GNU Affero General Public License version 3 (see the file LICENSE). |
712 | |
713 | +from __future__ import absolute_import, print_function, unicode_literals |
714 | + |
715 | __metaclass__ = type |
716 | |
717 | from datetime import ( |
718 | |
719 | === modified file 'lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py' |
720 | --- lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py 2016-06-17 15:46:57 +0000 |
721 | +++ lib/lp/soyuz/tests/test_distributionsourcepackagerelease.py 2018-02-02 10:33:11 +0000 |
722 | @@ -1,8 +1,10 @@ |
723 | -# Copyright 2011-2014 Canonical Ltd. This software is licensed under the |
724 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
725 | # GNU Affero General Public License version 3 (see the file LICENSE). |
726 | |
727 | """Tests of DistributionSourcePackageRelease.""" |
728 | |
729 | +from __future__ import absolute_import, print_function, unicode_literals |
730 | + |
731 | from storm.store import Store |
732 | from testtools.matchers import ( |
733 | Equals, |
734 | |
735 | === modified file 'lib/lp/soyuz/tests/test_distroseriesbinarypackage.py' |
736 | --- lib/lp/soyuz/tests/test_distroseriesbinarypackage.py 2018-01-02 10:54:31 +0000 |
737 | +++ lib/lp/soyuz/tests/test_distroseriesbinarypackage.py 2018-02-02 10:33:11 +0000 |
738 | @@ -1,8 +1,10 @@ |
739 | -# Copyright 2010-2016 Canonical Ltd. This software is licensed under the |
740 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
741 | # GNU Affero General Public License version 3 (see the file LICENSE). |
742 | |
743 | """Tests for `DistroSeriesBinaryPackage`.""" |
744 | |
745 | +from __future__ import absolute_import, print_function, unicode_literals |
746 | + |
747 | __metaclass__ = type |
748 | __all__ = [ |
749 | 'TestDistroSeriesBinaryPackage', |
750 | |
751 | === modified file 'lib/lp/soyuz/tests/test_distroseriesdifferencejob.py' |
752 | --- lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2018-01-02 16:10:26 +0000 |
753 | +++ lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2018-02-02 10:33:11 +0000 |
754 | @@ -1,8 +1,10 @@ |
755 | -# Copyright 2011-2013 Canonical Ltd. This software is licensed under the |
756 | +# Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
757 | # GNU Affero General Public License version 3 (see the file LICENSE). |
758 | |
759 | """Test `DistroSeriesDifferenceJob` and utility.""" |
760 | |
761 | +from __future__ import absolute_import, print_function, unicode_literals |
762 | + |
763 | __metaclass__ = type |
764 | |
765 | from psycopg2 import ProgrammingError |
766 | @@ -174,8 +176,8 @@ |
767 | |
768 | sourcepackagenameid = spph.sourcepackagerelease.sourcepackagename.id |
769 | expected_metadata = { |
770 | - u'sourcepackagename': sourcepackagenameid, |
771 | - u'parent_series': dsp.parent_series.id} |
772 | + 'sourcepackagename': sourcepackagenameid, |
773 | + 'parent_series': dsp.parent_series.id} |
774 | self.assertThat(job, MatchesStructure.byEquality( |
775 | distribution=dsp.derived_series.distribution, |
776 | distroseries=dsp.derived_series, |
777 | @@ -202,7 +204,7 @@ |
778 | self.assertContentEqual( |
779 | [spph.sourcepackagerelease.sourcepackagename.id |
780 | for spph in spphs], |
781 | - [job.metadata[u'sourcepackagename'] for job in jobs]) |
782 | + [job.metadata['sourcepackagename'] for job in jobs]) |
783 | |
784 | def test_create_multiple_jobs_creates_waiting_jobs(self): |
785 | dsp = self.factory.makeDistroSeriesParent() |
786 | |
787 | === modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py' |
788 | --- lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py 2016-02-05 16:51:12 +0000 |
789 | +++ lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py 2018-02-02 10:33:11 +0000 |
790 | @@ -1,4 +1,4 @@ |
791 | -# Copyright 2012-2016 Canonical Ltd. This software is licensed under the |
792 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
793 | # GNU Affero General Public License version 3 (see the file LICENSE). |
794 | |
795 | """Test upload and queue manipulation of DDTP tarballs. |
796 | @@ -14,6 +14,8 @@ |
797 | ddtp-tarball extraction. |
798 | """ |
799 | |
800 | +from __future__ import absolute_import, print_function, unicode_literals |
801 | + |
802 | import os |
803 | |
804 | import transaction |
805 | |
806 | === modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py' |
807 | --- lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py 2016-02-05 16:51:12 +0000 |
808 | +++ lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py 2018-02-02 10:33:11 +0000 |
809 | @@ -1,4 +1,4 @@ |
810 | -# Copyright 2012-2016 Canonical Ltd. This software is licensed under the |
811 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
812 | # GNU Affero General Public License version 3 (see the file LICENSE). |
813 | |
814 | """Test upload and queue manipulation of debian-installer custom uploads. |
815 | @@ -7,6 +7,8 @@ |
816 | of debian-installer custom upload extraction. |
817 | """ |
818 | |
819 | +from __future__ import absolute_import, print_function, unicode_literals |
820 | + |
821 | from itertools import chain |
822 | import os |
823 | |
824 | |
825 | === modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py' |
826 | --- lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py 2016-02-05 16:51:12 +0000 |
827 | +++ lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py 2018-02-02 10:33:11 +0000 |
828 | @@ -1,4 +1,4 @@ |
829 | -# Copyright 2012-2016 Canonical Ltd. This software is licensed under the |
830 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
831 | # GNU Affero General Public License version 3 (see the file LICENSE). |
832 | |
833 | """Test upload and queue manipulation of dist-upgrader tarballs. |
834 | @@ -7,6 +7,8 @@ |
835 | dist-upgrader tarball extraction. |
836 | """ |
837 | |
838 | +from __future__ import absolute_import, print_function, unicode_literals |
839 | + |
840 | import os |
841 | import shutil |
842 | |
843 | |
844 | === modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py' |
845 | --- lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py 2014-04-24 06:45:51 +0000 |
846 | +++ lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py 2018-02-02 10:33:11 +0000 |
847 | @@ -1,4 +1,4 @@ |
848 | -# Copyright 2013 Canonical Ltd. This software is licensed under the |
849 | +# Copyright 2013-2018 Canonical Ltd. This software is licensed under the |
850 | # GNU Affero General Public License version 3 (see the file LICENSE). |
851 | |
852 | """Test upload and queue manipulation of Rosetta Translations' tarballs. |
853 | @@ -7,10 +7,13 @@ |
854 | tests of rosetta-translations handling. |
855 | """ |
856 | |
857 | -import transaction |
858 | +from __future__ import absolute_import, print_function, unicode_literals |
859 | + |
860 | from os.path import relpath |
861 | +from tarfile import TarFile |
862 | + |
863 | from storm.expr import Desc |
864 | -from tarfile import TarFile |
865 | +import transaction |
866 | from zope.component import getUtility |
867 | |
868 | from lp.archiveuploader.nascentupload import NascentUpload |
869 | @@ -36,10 +39,10 @@ |
870 | from lp.testing.dbuser import dbuser |
871 | from lp.testing.gpgkeys import import_public_test_keys |
872 | from lp.testing.layers import LaunchpadZopelessLayer |
873 | +from lp.translations.enums import RosettaImportStatus |
874 | from lp.translations.interfaces.translationimportqueue import ( |
875 | ITranslationImportQueue, |
876 | ) |
877 | -from lp.translations.enums import RosettaImportStatus |
878 | from lp.translations.scripts.import_queue_gardener import ImportQueueGardener |
879 | from lp.translations.scripts.po_import import TranslationsImport |
880 | |
881 | @@ -172,7 +175,7 @@ |
882 | self.assertTrue(upload.do_accept()) |
883 | |
884 | self.assertEqual(upload.queue_root.status, PackageUploadStatus.DONE) |
885 | - spph = self.name16.archive.getPublishedSources(name=u"pmount").one() |
886 | + spph = self.name16.archive.getPublishedSources(name="pmount").one() |
887 | self.assertIsNotNone(spph) |
888 | transaction.commit() |
889 | |
890 | @@ -228,8 +231,7 @@ |
891 | with dbuser('copy_packages'): |
892 | copy_job.run() |
893 | |
894 | - published_source = target_archive.getPublishedSources( |
895 | - name=u'pmount')[0] |
896 | + published_source = target_archive.getPublishedSources(name='pmount')[0] |
897 | self.assertIsNotNone(published_source) |
898 | self.assertEqual( |
899 | published_source.sourcepackagerelease.upload_archive.displayname, |
900 | |
901 | === modified file 'lib/lp/soyuz/tests/test_doc.py' |
902 | --- lib/lp/soyuz/tests/test_doc.py 2015-09-04 12:19:07 +0000 |
903 | +++ lib/lp/soyuz/tests/test_doc.py 2018-02-02 10:33:11 +0000 |
904 | @@ -1,10 +1,12 @@ |
905 | -# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
906 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
907 | # GNU Affero General Public License version 3 (see the file LICENSE). |
908 | |
909 | """ |
910 | Run the doctests and pagetests. |
911 | """ |
912 | |
913 | +from __future__ import absolute_import, print_function, unicode_literals |
914 | + |
915 | import logging |
916 | import os |
917 | import unittest |
918 | |
919 | === modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py' |
920 | --- lib/lp/soyuz/tests/test_hasbuildrecords.py 2018-01-02 16:10:26 +0000 |
921 | +++ lib/lp/soyuz/tests/test_hasbuildrecords.py 2018-02-02 10:33:11 +0000 |
922 | @@ -1,8 +1,10 @@ |
923 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
924 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
925 | # GNU Affero General Public License version 3 (see the file LICENSE). |
926 | |
927 | """Test implementations of the IHasBuildRecords interface.""" |
928 | |
929 | +from __future__ import absolute_import, print_function, unicode_literals |
930 | + |
931 | from zope.component import getUtility |
932 | from zope.security.proxy import removeSecurityProxy |
933 | |
934 | |
935 | === modified file 'lib/lp/soyuz/tests/test_initializedistroseriesjob.py' |
936 | --- lib/lp/soyuz/tests/test_initializedistroseriesjob.py 2015-04-20 15:59:52 +0000 |
937 | +++ lib/lp/soyuz/tests/test_initializedistroseriesjob.py 2018-02-02 10:33:11 +0000 |
938 | @@ -1,6 +1,8 @@ |
939 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
940 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
941 | # GNU Affero General Public License version 3 (see the file LICENSE). |
942 | |
943 | +from __future__ import absolute_import, print_function, unicode_literals |
944 | + |
945 | __metaclass__ = type |
946 | |
947 | import transaction |
948 | @@ -82,10 +84,10 @@ |
949 | packageset2 = self.factory.makePackageset() |
950 | |
951 | overlays = (True, False) |
952 | - overlay_pockets = (u'Updates', u'Release') |
953 | - overlay_components = (u"main", u"universe") |
954 | - arches = (u'i386', u'amd64') |
955 | - archindep_archtag = u'amd64' |
956 | + overlay_pockets = ('Updates', 'Release') |
957 | + overlay_components = ("main", "universe") |
958 | + arches = ('i386', 'amd64') |
959 | + archindep_archtag = 'amd64' |
960 | packagesets = (packageset1.id, packageset2.id) |
961 | rebuild = False |
962 | |
963 | @@ -171,9 +173,9 @@ |
964 | be gotten out again.""" |
965 | parent = self.factory.makeDistroSeries() |
966 | distroseries = self.factory.makeDistroSeries() |
967 | - arches = (u'i386', u'amd64') |
968 | - archindep_archtag = u'amd64' |
969 | - packagesets = (u'1', u'2', u'3') |
970 | + arches = ('i386', 'amd64') |
971 | + archindep_archtag = 'amd64' |
972 | + packagesets = ('1', '2', '3') |
973 | overlays = (True, ) |
974 | overlay_pockets = ('Updates', ) |
975 | overlay_components = ('restricted', ) |
976 | @@ -251,7 +253,7 @@ |
977 | version=packages[package], |
978 | status=PackagePublishingStatus.PUBLISHED) |
979 | test1 = getUtility(IPackagesetSet).new( |
980 | - u'test1', u'test 1 packageset', parent.owner, |
981 | + 'test1', 'test 1 packageset', parent.owner, |
982 | distroseries=parent) |
983 | test1_packageset_id = str(test1.id) |
984 | test1.addSources('udev') |
985 | |
986 | === modified file 'lib/lp/soyuz/tests/test_livefs.py' |
987 | --- lib/lp/soyuz/tests/test_livefs.py 2017-07-18 16:22:03 +0000 |
988 | +++ lib/lp/soyuz/tests/test_livefs.py 2018-02-02 10:33:11 +0000 |
989 | @@ -1,8 +1,10 @@ |
990 | -# Copyright 2014-2017 Canonical Ltd. This software is licensed under the |
991 | +# Copyright 2014-2018 Canonical Ltd. This software is licensed under the |
992 | # GNU Affero General Public License version 3 (see the file LICENSE). |
993 | |
994 | """Test live filesystems.""" |
995 | |
996 | +from __future__ import absolute_import, print_function, unicode_literals |
997 | + |
998 | __metaclass__ = type |
999 | |
1000 | from datetime import ( |
1001 | @@ -81,7 +83,7 @@ |
1002 | |
1003 | def setUp(self): |
1004 | super(TestLiveFS, self).setUp() |
1005 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1006 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1007 | |
1008 | def test_implements_interfaces(self): |
1009 | # LiveFS implements ILiveFS. |
1010 | @@ -246,8 +248,8 @@ |
1011 | build.updateStatus(BuildStatus.FULLYBUILT) |
1012 | build = livefs.requestBuild( |
1013 | livefs.owner, livefs.distro_series.main_archive, distroarchseries, |
1014 | - PackagePublishingPocket.RELEASE, version=u"20150101") |
1015 | - self.assertEqual(u"20150101", build.version) |
1016 | + PackagePublishingPocket.RELEASE, version="20150101") |
1017 | + self.assertEqual("20150101", build.version) |
1018 | |
1019 | def test_getBuilds(self): |
1020 | # Test the various getBuilds methods. |
1021 | @@ -302,13 +304,13 @@ |
1022 | distroseries = self.factory.makeDistroSeries() |
1023 | livefs = self.factory.makeLiveFS( |
1024 | registrant=owner, owner=owner, distroseries=distroseries, |
1025 | - name=u"condemned") |
1026 | + name="condemned") |
1027 | self.assertTrue( |
1028 | - getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned")) |
1029 | + getUtility(ILiveFSSet).exists(owner, distroseries, "condemned")) |
1030 | with person_logged_in(livefs.owner): |
1031 | livefs.destroySelf() |
1032 | self.assertFalse( |
1033 | - getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned")) |
1034 | + getUtility(ILiveFSSet).exists(owner, distroseries, "condemned")) |
1035 | |
1036 | def test_delete_with_builds(self): |
1037 | # A live filesystem with builds cannot be deleted. |
1038 | @@ -316,14 +318,14 @@ |
1039 | distroseries = self.factory.makeDistroSeries() |
1040 | livefs = self.factory.makeLiveFS( |
1041 | registrant=owner, owner=owner, distroseries=distroseries, |
1042 | - name=u"condemned") |
1043 | + name="condemned") |
1044 | self.factory.makeLiveFSBuild(livefs=livefs) |
1045 | self.assertTrue( |
1046 | - getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned")) |
1047 | + getUtility(ILiveFSSet).exists(owner, distroseries, "condemned")) |
1048 | with person_logged_in(livefs.owner): |
1049 | self.assertRaises(CannotDeleteLiveFS, livefs.destroySelf) |
1050 | self.assertTrue( |
1051 | - getUtility(ILiveFSSet).exists(owner, distroseries, u"condemned")) |
1052 | + getUtility(ILiveFSSet).exists(owner, distroseries, "condemned")) |
1053 | |
1054 | |
1055 | class TestLiveFSSet(TestCaseWithFactory): |
1056 | @@ -332,7 +334,7 @@ |
1057 | |
1058 | def setUp(self): |
1059 | super(TestLiveFSSet, self).setUp() |
1060 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1061 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1062 | |
1063 | def test_class_implements_interfaces(self): |
1064 | # The LiveFSSet class implements ILiveFSSet. |
1065 | @@ -350,7 +352,7 @@ |
1066 | registrant=registrant, |
1067 | owner=self.factory.makeTeam(owner=registrant), |
1068 | distro_series=self.factory.makeDistroSeries(), |
1069 | - name=self.factory.getUniqueString(u"livefs-name"), |
1070 | + name=self.factory.getUniqueString("livefs-name"), |
1071 | metadata=metadata) |
1072 | |
1073 | def test_creation(self): |
1074 | @@ -380,7 +382,7 @@ |
1075 | livefs.owner, self.factory.makeDistroSeries(), livefs.name)) |
1076 | self.assertFalse( |
1077 | getUtility(ILiveFSSet).exists( |
1078 | - livefs.owner, livefs.distro_series, u"different")) |
1079 | + livefs.owner, livefs.distro_series, "different")) |
1080 | |
1081 | def test_getByPerson(self): |
1082 | # ILiveFSSet.getByPerson returns all LiveFSes with the given owner. |
1083 | @@ -427,7 +429,7 @@ |
1084 | |
1085 | def setUp(self): |
1086 | super(TestLiveFSWebservice, self).setUp() |
1087 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1088 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1089 | self.person = self.factory.makePerson(displayname="Test Person") |
1090 | self.webservice = webservice_for_person( |
1091 | self.person, permission=OAuthPermission.WRITE_PUBLIC) |
1092 | |
1093 | === modified file 'lib/lp/soyuz/tests/test_livefsbuild.py' |
1094 | --- lib/lp/soyuz/tests/test_livefsbuild.py 2016-08-12 12:56:41 +0000 |
1095 | +++ lib/lp/soyuz/tests/test_livefsbuild.py 2018-02-02 10:33:11 +0000 |
1096 | @@ -1,8 +1,10 @@ |
1097 | -# Copyright 2014-2016 Canonical Ltd. This software is licensed under the |
1098 | +# Copyright 2014-2018 Canonical Ltd. This software is licensed under the |
1099 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1100 | |
1101 | """Test live filesystem build features.""" |
1102 | |
1103 | +from __future__ import absolute_import, print_function, unicode_literals |
1104 | + |
1105 | __metaclass__ = type |
1106 | |
1107 | from datetime import ( |
1108 | @@ -90,7 +92,7 @@ |
1109 | |
1110 | def setUp(self): |
1111 | super(TestLiveFSBuild, self).setUp() |
1112 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1113 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1114 | self.build = self.factory.makeLiveFSBuild() |
1115 | |
1116 | def test_implements_interfaces(self): |
1117 | @@ -238,7 +240,7 @@ |
1118 | distroseries=distroseries, architecturetag="i386", |
1119 | processor=processor) |
1120 | build = self.factory.makeLiveFSBuild( |
1121 | - name=u"livefs-1", requester=person, owner=person, |
1122 | + name="livefs-1", requester=person, owner=person, |
1123 | distroarchseries=distroarchseries, |
1124 | date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC), |
1125 | status=BuildStatus.FAILEDTOBUILD, |
1126 | @@ -291,7 +293,7 @@ |
1127 | |
1128 | def setUp(self): |
1129 | super(TestLiveFSBuildSet, self).setUp() |
1130 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1131 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1132 | |
1133 | def test_getByBuildFarmJob_works(self): |
1134 | build = self.factory.makeLiveFSBuild() |
1135 | @@ -323,7 +325,7 @@ |
1136 | |
1137 | def setUp(self): |
1138 | super(TestLiveFSBuildWebservice, self).setUp() |
1139 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1140 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1141 | self.person = self.factory.makePerson() |
1142 | self.webservice = webservice_for_person( |
1143 | self.person, permission=OAuthPermission.WRITE_PRIVATE) |
1144 | @@ -336,7 +338,7 @@ |
1145 | def test_properties(self): |
1146 | # The basic properties of a LiveFSBuild are sensible. |
1147 | db_build = self.factory.makeLiveFSBuild( |
1148 | - requester=self.person, unique_key=u"foo", |
1149 | + requester=self.person, unique_key="foo", |
1150 | metadata_override={"image_format": "plain"}, |
1151 | date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC)) |
1152 | build_url = api_url(db_build) |
1153 | |
1154 | === modified file 'lib/lp/soyuz/tests/test_livefsbuildbehaviour.py' |
1155 | --- lib/lp/soyuz/tests/test_livefsbuildbehaviour.py 2017-04-29 23:51:28 +0000 |
1156 | +++ lib/lp/soyuz/tests/test_livefsbuildbehaviour.py 2018-02-02 10:33:11 +0000 |
1157 | @@ -1,8 +1,10 @@ |
1158 | -# Copyright 2014-2017 Canonical Ltd. This software is licensed under the |
1159 | +# Copyright 2014-2018 Canonical Ltd. This software is licensed under the |
1160 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1161 | |
1162 | """Test live filesystem build behaviour.""" |
1163 | |
1164 | +from __future__ import absolute_import, print_function, unicode_literals |
1165 | + |
1166 | __metaclass__ = type |
1167 | |
1168 | from datetime import datetime |
1169 | @@ -63,7 +65,7 @@ |
1170 | |
1171 | def setUp(self): |
1172 | super(TestLiveFSBuildBehaviourBase, self).setUp() |
1173 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1174 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1175 | |
1176 | def makeJob(self, archive=None, pocket=PackagePublishingPocket.RELEASE, |
1177 | **kwargs): |
1178 | @@ -80,7 +82,7 @@ |
1179 | processor=processor) |
1180 | build = self.factory.makeLiveFSBuild( |
1181 | archive=archive, distroarchseries=distroarchseries, pocket=pocket, |
1182 | - name=u"test-livefs", **kwargs) |
1183 | + name="test-livefs", **kwargs) |
1184 | return IBuildFarmJobBehaviour(build) |
1185 | |
1186 | |
1187 | @@ -256,13 +258,13 @@ |
1188 | """Provide the common makeBuild method returning a queued build.""" |
1189 | |
1190 | def makeBuild(self): |
1191 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1192 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1193 | build = self.factory.makeLiveFSBuild(status=BuildStatus.BUILDING) |
1194 | build.queueBuild() |
1195 | return build |
1196 | |
1197 | def makeUnmodifiableBuild(self): |
1198 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
1199 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
1200 | build = self.factory.makeLiveFSBuild(status=BuildStatus.BUILDING) |
1201 | build.distro_series.status = SeriesStatus.OBSOLETE |
1202 | build.queueBuild() |
1203 | |
1204 | === modified file 'lib/lp/soyuz/tests/test_packagecloner.py' |
1205 | --- lib/lp/soyuz/tests/test_packagecloner.py 2015-05-18 22:56:02 +0000 |
1206 | +++ lib/lp/soyuz/tests/test_packagecloner.py 2018-02-02 10:33:11 +0000 |
1207 | @@ -1,6 +1,8 @@ |
1208 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
1209 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1210 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1211 | |
1212 | +from __future__ import absolute_import, print_function, unicode_literals |
1213 | + |
1214 | __metaclass__ = type |
1215 | |
1216 | from zope.component import getUtility |
1217 | |
1218 | === modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py' |
1219 | --- lib/lp/soyuz/tests/test_packagecopyjob.py 2016-10-17 09:15:51 +0000 |
1220 | +++ lib/lp/soyuz/tests/test_packagecopyjob.py 2018-02-02 10:33:11 +0000 |
1221 | @@ -1,8 +1,10 @@ |
1222 | -# Copyright 2010-2016 Canonical Ltd. This software is licensed under the |
1223 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1224 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1225 | |
1226 | """Tests for sync package jobs.""" |
1227 | |
1228 | +from __future__ import absolute_import, print_function, unicode_literals |
1229 | + |
1230 | import operator |
1231 | from textwrap import dedent |
1232 | |
1233 | @@ -507,7 +509,7 @@ |
1234 | job.run() |
1235 | |
1236 | published_sources = job.target_archive.getPublishedSources( |
1237 | - name=u"libc", version="2.8-1") |
1238 | + name="libc", version="2.8-1") |
1239 | self.assertIsNot(None, published_sources.any()) |
1240 | |
1241 | # The copy should have sent an email too. (see |
1242 | @@ -606,7 +608,7 @@ |
1243 | |
1244 | self.assertEqual(0, exit_code) |
1245 | copied_source_package = archive2.getPublishedSources( |
1246 | - name=u"libc", version="2.8-1", exact_match=True).first() |
1247 | + name="libc", version="2.8-1", exact_match=True).first() |
1248 | self.assertIsNot(copied_source_package, None) |
1249 | |
1250 | def test___repr__(self): |
1251 | @@ -784,7 +786,7 @@ |
1252 | self.runJob(job) |
1253 | |
1254 | new_spph = target_archive.getPublishedSources( |
1255 | - name=u'libc', version='2.8-1').one() |
1256 | + name='libc', version='2.8-1').one() |
1257 | self.assertEqual('restricted', new_spph.component.name) |
1258 | self.assertEqual('games', new_spph.section.name) |
1259 | |
1260 | @@ -795,7 +797,7 @@ |
1261 | |
1262 | # The binary has inherited its old primary component. |
1263 | new_bpph = target_archive.getAllPublishedBinaries( |
1264 | - name=u'copyme', version='2.8-1')[0] |
1265 | + name='copyme', version='2.8-1')[0] |
1266 | self.assertEqual('multiverse', new_bpph.component.name) |
1267 | |
1268 | def test_copying_to_ppa_archive(self): |
1269 | @@ -828,7 +830,7 @@ |
1270 | self.assertEqual(JobStatus.COMPLETED, job.status) |
1271 | |
1272 | new_publication = target_archive.getPublishedSources( |
1273 | - name=u'libc', version='2.8-1').one() |
1274 | + name='libc', version='2.8-1').one() |
1275 | self.assertEqual('main', new_publication.component.name) |
1276 | self.assertEqual('web', new_publication.section.name) |
1277 | |
1278 | @@ -878,7 +880,7 @@ |
1279 | # The copied source should have the manual overrides, not the |
1280 | # original values. |
1281 | new_publication = target_archive.getPublishedSources( |
1282 | - name=u'copyme', version='2.8-1').one() |
1283 | + name='copyme', version='2.8-1').one() |
1284 | self.assertEqual('restricted', new_publication.component.name) |
1285 | self.assertEqual('editors', new_publication.section.name) |
1286 | |
1287 | @@ -899,7 +901,7 @@ |
1288 | |
1289 | # There is no package of the same name already in the target |
1290 | # archive. |
1291 | - existing_sources = target_archive.getPublishedSources(name=u'copyme') |
1292 | + existing_sources = target_archive.getPublishedSources(name='copyme') |
1293 | self.assertEqual(None, existing_sources.any()) |
1294 | |
1295 | # Now, run the copy job. |
1296 | @@ -1020,7 +1022,7 @@ |
1297 | spph, archive, archive, requester=archive.owner) |
1298 | self.runJob(job) |
1299 | self.assertEqual(JobStatus.COMPLETED, job.status) |
1300 | - published_sources = archive.getPublishedSources(name=u"copyme") |
1301 | + published_sources = archive.getPublishedSources(name="copyme") |
1302 | self.assertIsNotNone(published_sources.any()) |
1303 | |
1304 | def test_copying_resurrects_deleted_package_primary_new(self): |
1305 | @@ -1233,10 +1235,10 @@ |
1306 | # Make sure packages were actually copied. The source has the |
1307 | # override that we gave to the PackageUpload, and its new |
1308 | # binaries inherit its component. |
1309 | - existing_sources = target_archive.getPublishedSources(name=u'copyme') |
1310 | + existing_sources = target_archive.getPublishedSources(name='copyme') |
1311 | self.assertEqual('restricted', existing_sources.one().component.name) |
1312 | existing_binaries = target_archive.getAllPublishedBinaries( |
1313 | - name=u'copyme') |
1314 | + name='copyme') |
1315 | self.assertEqual('restricted', existing_binaries[0].component.name) |
1316 | |
1317 | # It would be nice to test emails in a separate test but it would |
1318 | @@ -1311,7 +1313,7 @@ |
1319 | * closes: %s |
1320 | |
1321 | -- Foo Bar <foo@example.com> Tue, 01 Jan 1970 01:50:41 +0000 |
1322 | - """ % (bug282.id, bug281.id, bug280.id)) |
1323 | + """ % (bug282.id, bug281.id, bug280.id)).encode("UTF-8") |
1324 | spr.changelog = self.factory.makeLibraryFileAlias(content=changelog) |
1325 | spr.changelog_entry = "dummy" |
1326 | self.layer.txn.commit() # Librarian. |
1327 | @@ -1406,10 +1408,10 @@ |
1328 | |
1329 | # Make sure packages were actually copied. |
1330 | copied_sources = target_archive.getPublishedSources( |
1331 | - name=u"copyme", version="2.8-1") |
1332 | + name="copyme", version="2.8-1") |
1333 | self.assertNotEqual(0, copied_sources.count()) |
1334 | copied_binaries = target_archive.getAllPublishedBinaries( |
1335 | - name=u"copyme") |
1336 | + name="copyme") |
1337 | self.assertNotEqual(0, copied_binaries.count()) |
1338 | |
1339 | # Check that files were unembargoed. |
1340 | @@ -1525,7 +1527,7 @@ |
1341 | # Make sure packages were copied with the correct |
1342 | # phased_update_percentage. |
1343 | copied_binaries = archive.getAllPublishedBinaries( |
1344 | - name=u"copyme", pocket=PackagePublishingPocket.UPDATES) |
1345 | + name="copyme", pocket=PackagePublishingPocket.UPDATES) |
1346 | self.assertNotEqual(0, copied_binaries.count()) |
1347 | for binary in copied_binaries: |
1348 | self.assertEqual(0, binary.phased_update_percentage) |
1349 | @@ -1752,7 +1754,7 @@ |
1350 | transaction.commit() |
1351 | |
1352 | published_sources = job.target_archive.getPublishedSources( |
1353 | - name=u"libc", version="2.8-1") |
1354 | + name="libc", version="2.8-1") |
1355 | self.assertIsNot(None, published_sources.any()) |
1356 | |
1357 | # The copy should have sent an email too. (see |
1358 | @@ -1765,13 +1767,13 @@ |
1359 | # Accepting a suspended copy from the queue sends it back |
1360 | # through celery. |
1361 | source_pub = self.factory.makeSourcePackagePublishingHistory( |
1362 | - component=u"main", status=PackagePublishingStatus.PUBLISHED) |
1363 | + component="main", status=PackagePublishingStatus.PUBLISHED) |
1364 | target_series = self.factory.makeDistroSeries() |
1365 | getUtility(ISourcePackageFormatSelectionSet).add( |
1366 | target_series, SourcePackageFormat.FORMAT_1_0) |
1367 | requester = self.factory.makePerson() |
1368 | with person_logged_in(target_series.main_archive.owner): |
1369 | - target_series.main_archive.newComponentUploader(requester, u"main") |
1370 | + target_series.main_archive.newComponentUploader(requester, "main") |
1371 | job = getUtility(IPlainPackageCopyJobSource).create( |
1372 | package_name=source_pub.source_package_name, |
1373 | package_version=source_pub.source_package_version, |
1374 | |
1375 | === modified file 'lib/lp/soyuz/tests/test_packagediff.py' |
1376 | --- lib/lp/soyuz/tests/test_packagediff.py 2015-12-02 10:57:23 +0000 |
1377 | +++ lib/lp/soyuz/tests/test_packagediff.py 2018-02-02 10:33:11 +0000 |
1378 | @@ -1,9 +1,9 @@ |
1379 | -# Copyright 2010-2015 Canonical Ltd. This software is licensed under the |
1380 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1381 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1382 | |
1383 | """Test source package diffs.""" |
1384 | |
1385 | -from __future__ import print_function |
1386 | +from __future__ import absolute_import, print_function, unicode_literals |
1387 | |
1388 | __metaclass__ = type |
1389 | |
1390 | |
1391 | === modified file 'lib/lp/soyuz/tests/test_packagediffjob.py' |
1392 | --- lib/lp/soyuz/tests/test_packagediffjob.py 2015-06-05 21:24:50 +0000 |
1393 | +++ lib/lp/soyuz/tests/test_packagediffjob.py 2018-02-02 10:33:11 +0000 |
1394 | @@ -1,6 +1,8 @@ |
1395 | -# Copyright 2013 Canonical Ltd. This software is licensed under the |
1396 | +# Copyright 2013-2018 Canonical Ltd. This software is licensed under the |
1397 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1398 | |
1399 | +from __future__ import absolute_import, print_function, unicode_literals |
1400 | + |
1401 | __metaclass__ = type |
1402 | |
1403 | from testtools.content import text_content |
1404 | |
1405 | === modified file 'lib/lp/soyuz/tests/test_packageset.py' |
1406 | --- lib/lp/soyuz/tests/test_packageset.py 2018-01-02 10:54:31 +0000 |
1407 | +++ lib/lp/soyuz/tests/test_packageset.py 2018-02-02 10:33:11 +0000 |
1408 | @@ -1,8 +1,10 @@ |
1409 | -# Copyright 2009-2014 Canonical Ltd. This software is licensed under the |
1410 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1411 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1412 | |
1413 | """Test Packageset features.""" |
1414 | |
1415 | +from __future__ import absolute_import, print_function, unicode_literals |
1416 | + |
1417 | from zope.component import getUtility |
1418 | from zope.security.interfaces import Unauthorized |
1419 | |
1420 | @@ -268,7 +270,7 @@ |
1421 | status=SeriesStatus.EXPERIMENTAL) |
1422 | |
1423 | self.person1 = self.factory.makePerson( |
1424 | - name='hacker', displayname=u'Happy Hacker') |
1425 | + name='hacker', displayname='Happy Hacker') |
1426 | |
1427 | self.packageset_set = getUtility(IPackagesetSet) |
1428 | |
1429 | @@ -276,7 +278,7 @@ |
1430 | # If the package set is the only one in the group the result set |
1431 | # returned by relatedSets() is empty. |
1432 | packageset = self.packageset_set.new( |
1433 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1434 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1435 | self.distroseries_current) |
1436 | |
1437 | self.assertEqual(packageset.relatedSets().count(), 0) |
1438 | @@ -288,18 +290,18 @@ |
1439 | |
1440 | # The original package set. |
1441 | pset1 = self.packageset_set.new( |
1442 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1443 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1444 | distroseries=self.distroseries_current) |
1445 | |
1446 | # A related package set. |
1447 | pset2 = self.packageset_set.new( |
1448 | - u'kernel', u'A related package set.', self.person1, |
1449 | + 'kernel', 'A related package set.', self.person1, |
1450 | distroseries=self.distroseries_experimental, related_set=pset1) |
1451 | self.assertEqual(pset1.packagesetgroup, pset2.packagesetgroup) |
1452 | |
1453 | # An unrelated package set with the same name. |
1454 | pset3 = self.packageset_set.new( |
1455 | - u'kernel', u'Unrelated package set.', self.person1, |
1456 | + 'kernel', 'Unrelated package set.', self.person1, |
1457 | distroseries=self.distroseries_experimental2) |
1458 | self.assertNotEqual(pset2.packagesetgroup, pset3.packagesetgroup) |
1459 | |
1460 | @@ -320,12 +322,12 @@ |
1461 | def test_destroy(self): |
1462 | series = self.factory.makeDistroSeries() |
1463 | pset = self.packageset_set.new( |
1464 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1465 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1466 | series) |
1467 | pset.destroySelf() |
1468 | self.assertRaises( |
1469 | NoSuchPackageSet, self.packageset_set.getByName, series, |
1470 | - u'kernel') |
1471 | + 'kernel') |
1472 | |
1473 | # Did we clean up the single packagesetgroup? |
1474 | store = IStore(PackagesetGroup) |
1475 | @@ -334,20 +336,20 @@ |
1476 | |
1477 | def test_destroy_with_ancestor(self): |
1478 | ancestor = self.packageset_set.new( |
1479 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1480 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1481 | distroseries=self.distroseries_current) |
1482 | pset = self.packageset_set.new( |
1483 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1484 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1485 | distroseries=self.distroseries_experimental, related_set=ancestor) |
1486 | pset.destroySelf() |
1487 | self.assertRaises( |
1488 | NoSuchPackageSet, self.packageset_set.getByName, |
1489 | - self.distroseries_experimental, u'kernel') |
1490 | + self.distroseries_experimental, 'kernel') |
1491 | |
1492 | def test_destroy_with_packages(self): |
1493 | series = self.factory.makeDistroSeries() |
1494 | pset = self.packageset_set.new( |
1495 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1496 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1497 | series) |
1498 | package = self.factory.makeSourcePackageName() |
1499 | pset.addSources([package.name]) |
1500 | @@ -355,37 +357,37 @@ |
1501 | pset.destroySelf() |
1502 | self.assertRaises( |
1503 | NoSuchPackageSet, self.packageset_set.getByName, series, |
1504 | - u'kernel') |
1505 | + 'kernel') |
1506 | |
1507 | def test_destroy_child(self): |
1508 | series = self.factory.makeDistroSeries() |
1509 | parent = self.packageset_set.new( |
1510 | - u'core', u'Contains all the important packages', self.person1, |
1511 | + 'core', 'Contains all the important packages', self.person1, |
1512 | series) |
1513 | child = self.packageset_set.new( |
1514 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1515 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1516 | series) |
1517 | parent.add((child,)) |
1518 | |
1519 | child.destroySelf() |
1520 | self.assertRaises( |
1521 | NoSuchPackageSet, self.packageset_set.getByName, series, |
1522 | - u'kernel') |
1523 | + 'kernel') |
1524 | self.assertTrue(parent.setsIncluded(direct_inclusion=True).is_empty()) |
1525 | |
1526 | def test_destroy_parent(self): |
1527 | series = self.factory.makeDistroSeries() |
1528 | parent = self.packageset_set.new( |
1529 | - u'core', u'Contains all the important packages', self.person1, |
1530 | + 'core', 'Contains all the important packages', self.person1, |
1531 | series) |
1532 | child = self.packageset_set.new( |
1533 | - u'kernel', u'Contains all OS kernel packages', self.person1, |
1534 | + 'kernel', 'Contains all OS kernel packages', self.person1, |
1535 | series) |
1536 | parent.add((child,)) |
1537 | |
1538 | parent.destroySelf() |
1539 | self.assertRaises( |
1540 | - NoSuchPackageSet, self.packageset_set.getByName, series, u'core') |
1541 | + NoSuchPackageSet, self.packageset_set.getByName, series, 'core') |
1542 | self.assertTrue(child.setsIncludedBy(direct_inclusion=True).is_empty()) |
1543 | |
1544 | def test_destroy_intermidate(self): |
1545 | @@ -667,10 +669,10 @@ |
1546 | # Normal users may not modify packagesets |
1547 | with person_logged_in(self.person2): |
1548 | self.assertRaises( |
1549 | - Unauthorized, setattr, self.packageset, 'name', u'renamed') |
1550 | + Unauthorized, setattr, self.packageset, 'name', 'renamed') |
1551 | self.assertRaises( |
1552 | Unauthorized, setattr, self.packageset, 'description', |
1553 | - u'Re-described') |
1554 | + 'Re-described') |
1555 | self.assertRaises( |
1556 | Unauthorized, setattr, self.packageset, 'owner', self.person2) |
1557 | self.assertRaises( |
1558 | @@ -687,8 +689,8 @@ |
1559 | Unauthorized, getattr, self.packageset, 'removeSubsets') |
1560 | |
1561 | def modifyPackageset(self): |
1562 | - self.packageset.name = u'renamed' |
1563 | - self.packageset.description = u'Re-described' |
1564 | + self.packageset.name = 'renamed' |
1565 | + self.packageset.description = 'Re-described' |
1566 | self.packageset.add((self.package,)) |
1567 | self.packageset.remove((self.package,)) |
1568 | self.packageset.addSources((self.package.name,)) |
1569 | |
1570 | === modified file 'lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py' |
1571 | --- lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py 2018-01-02 16:10:26 +0000 |
1572 | +++ lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py 2018-02-02 10:33:11 +0000 |
1573 | @@ -1,10 +1,12 @@ |
1574 | -# Copyright 2013 Canonical Ltd. This software is licensed under the |
1575 | +# Copyright 2013-2018 Canonical Ltd. This software is licensed under the |
1576 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1577 | |
1578 | +from __future__ import absolute_import, print_function, unicode_literals |
1579 | + |
1580 | __metaclass__ = type |
1581 | |
1582 | +from testtools.content import text_content |
1583 | import transaction |
1584 | -from testtools.content import text_content |
1585 | from zope.component import getUtility |
1586 | from zope.security.proxy import removeSecurityProxy |
1587 | |
1588 | |
1589 | === modified file 'lib/lp/soyuz/tests/test_packageupload.py' |
1590 | --- lib/lp/soyuz/tests/test_packageupload.py 2017-06-13 12:19:20 +0000 |
1591 | +++ lib/lp/soyuz/tests/test_packageupload.py 2018-02-02 10:33:11 +0000 |
1592 | @@ -1,8 +1,10 @@ |
1593 | -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
1594 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1595 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1596 | |
1597 | """Test Build features.""" |
1598 | |
1599 | +from __future__ import absolute_import, print_function, unicode_literals |
1600 | + |
1601 | from datetime import timedelta |
1602 | from urllib2 import ( |
1603 | HTTPError, |
1604 | @@ -316,7 +318,7 @@ |
1605 | |
1606 | # There are now duplicate uploads in UNAPPROVED. |
1607 | unapproved = distroseries.getPackageUploads( |
1608 | - status=PackageUploadStatus.UNAPPROVED, name=u"cnews") |
1609 | + status=PackageUploadStatus.UNAPPROVED, name="cnews") |
1610 | self.assertEqual(2, unapproved.count()) |
1611 | |
1612 | # Accepting one of them works. (Since it's a single source upload, |
1613 | @@ -806,13 +808,13 @@ |
1614 | def test_getAll_without_exact_match_escapes_name(self): |
1615 | distroseries = self.factory.makeDistroSeries() |
1616 | self.assertContentEqual( |
1617 | - [], self.upload_set.getAll(distroseries, name=u"'")) |
1618 | + [], self.upload_set.getAll(distroseries, name="'")) |
1619 | |
1620 | def test_getAll_with_exact_match_escapes_name(self): |
1621 | distroseries = self.factory.makeDistroSeries() |
1622 | self.assertContentEqual( |
1623 | [], self.upload_set.getAll( |
1624 | - distroseries, name=u"'", exact_match=True)) |
1625 | + distroseries, name="'", exact_match=True)) |
1626 | |
1627 | def test_getAll_matches_source_upload_by_version(self): |
1628 | distroseries = self.factory.makeDistroSeries() |
1629 | |
1630 | === modified file 'lib/lp/soyuz/tests/test_person_createppa.py' |
1631 | --- lib/lp/soyuz/tests/test_person_createppa.py 2015-05-12 05:45:08 +0000 |
1632 | +++ lib/lp/soyuz/tests/test_person_createppa.py 2018-02-02 10:33:11 +0000 |
1633 | @@ -1,8 +1,10 @@ |
1634 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
1635 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1636 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1637 | |
1638 | """Test the IPerson.createPPA() method.""" |
1639 | |
1640 | +from __future__ import absolute_import, print_function, unicode_literals |
1641 | + |
1642 | __metaclass__ = type |
1643 | |
1644 | from zope.security.interfaces import Unauthorized |
1645 | |
1646 | === modified file 'lib/lp/soyuz/tests/test_processacceptedbugsjob.py' |
1647 | --- lib/lp/soyuz/tests/test_processacceptedbugsjob.py 2014-08-09 09:21:13 +0000 |
1648 | +++ lib/lp/soyuz/tests/test_processacceptedbugsjob.py 2018-02-02 10:33:11 +0000 |
1649 | @@ -1,8 +1,10 @@ |
1650 | -# Copyright 2012-2014 Canonical Ltd. This software is licensed under the |
1651 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
1652 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1653 | |
1654 | """Tests for jobs to close bugs for accepted package uploads.""" |
1655 | |
1656 | +from __future__ import absolute_import, print_function, unicode_literals |
1657 | + |
1658 | from cStringIO import StringIO |
1659 | from itertools import product |
1660 | from textwrap import dedent |
1661 | @@ -169,7 +171,7 @@ |
1662 | bugs[3][0].id, |
1663 | bugs[4][0].id, |
1664 | bugs[5][0].id, |
1665 | - )) |
1666 | + )).encode("UTF-8") |
1667 | lfa = self.factory.makeLibraryFileAlias(content=changelog) |
1668 | removeSecurityProxy(spr).changelog = lfa |
1669 | self.layer.txn.commit() |
1670 | |
1671 | === modified file 'lib/lp/soyuz/tests/test_publishing.py' |
1672 | --- lib/lp/soyuz/tests/test_publishing.py 2016-09-24 06:21:55 +0000 |
1673 | +++ lib/lp/soyuz/tests/test_publishing.py 2018-02-02 10:33:11 +0000 |
1674 | @@ -1,8 +1,10 @@ |
1675 | -# Copyright 2009-2016 Canonical Ltd. This software is licensed under the |
1676 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1677 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1678 | |
1679 | """Test native publication workflow for Soyuz. """ |
1680 | |
1681 | +from __future__ import absolute_import, print_function, unicode_literals |
1682 | + |
1683 | import datetime |
1684 | import operator |
1685 | import os |
1686 | @@ -154,7 +156,7 @@ |
1687 | self.breezy_autotest_i386 = self.breezy_autotest['i386'] |
1688 | self.breezy_autotest_hppa = self.breezy_autotest['hppa'] |
1689 | |
1690 | - def addMockFile(self, filename, filecontent='nothing', restricted=False): |
1691 | + def addMockFile(self, filename, filecontent=b'nothing', restricted=False): |
1692 | """Add a mock file in Librarian. |
1693 | |
1694 | Returns a ILibraryFileAlias corresponding to the file uploaded. |
1695 | @@ -167,7 +169,7 @@ |
1696 | def addPackageUpload(self, archive, distroseries, |
1697 | pocket=PackagePublishingPocket.RELEASE, |
1698 | changes_file_name="foo_666_source.changes", |
1699 | - changes_file_content="fake changes file content", |
1700 | + changes_file_content=b"fake changes file content", |
1701 | upload_status=PackageUploadStatus.DONE): |
1702 | signing_key = self.person.gpg_keys[0] |
1703 | package_upload = distroseries.createQueueEntry( |
1704 | @@ -187,8 +189,8 @@ |
1705 | |
1706 | def getPubSource(self, sourcename=None, version=None, component='main', |
1707 | filename=None, section='base', |
1708 | - filecontent='I do not care about sources.', |
1709 | - changes_file_content="Fake: fake changes file content", |
1710 | + filecontent=b'I do not care about sources.', |
1711 | + changes_file_content=b"Fake: fake changes file content", |
1712 | status=PackagePublishingStatus.PENDING, |
1713 | pocket=PackagePublishingPocket.RELEASE, |
1714 | urgency=SourcePackageUrgency.LOW, |
1715 | @@ -299,8 +301,8 @@ |
1716 | shlibdep=None, depends=None, recommends=None, |
1717 | suggests=None, conflicts=None, replaces=None, |
1718 | provides=None, pre_depends=None, enhances=None, |
1719 | - breaks=None, filecontent='bbbiiinnnaaarrryyy', |
1720 | - changes_file_content="Fake: fake changes file", |
1721 | + breaks=None, filecontent=b'bbbiiinnnaaarrryyy', |
1722 | + changes_file_content=b"Fake: fake changes file", |
1723 | status=PackagePublishingStatus.PENDING, |
1724 | pocket=PackagePublishingPocket.RELEASE, |
1725 | format=BinaryPackageFormat.DEB, |
1726 | @@ -376,7 +378,7 @@ |
1727 | published_binaries, key=operator.attrgetter('id'), reverse=True) |
1728 | |
1729 | def uploadBinaryForBuild( |
1730 | - self, build, binaryname, filecontent="anything", |
1731 | + self, build, binaryname, filecontent=b"anything", |
1732 | summary="summary", description="description", shlibdep=None, |
1733 | depends=None, recommends=None, suggests=None, conflicts=None, |
1734 | replaces=None, provides=None, pre_depends=None, enhances=None, |
1735 | @@ -448,7 +450,7 @@ |
1736 | if not build.log: |
1737 | build.setLog( |
1738 | self.addMockFile( |
1739 | - buildlog_filename, filecontent='Built!', |
1740 | + buildlog_filename, filecontent=b'Built!', |
1741 | restricted=build.archive.private)) |
1742 | |
1743 | return binarypackagerelease |
1744 | @@ -674,7 +676,7 @@ |
1745 | def test_publish_source(self): |
1746 | # Source publications result in a PUBLISHED publishing record and |
1747 | # the corresponding files are dumped in the disk pool/. |
1748 | - pub_source = self.getPubSource(filecontent='Hello world') |
1749 | + pub_source = self.getPubSource(filecontent=b'Hello world') |
1750 | pub_source.publish(self.disk_pool, self.logger) |
1751 | self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status) |
1752 | pool_path = "%s/main/f/foo/foo_666.dsc" % self.pool_dir |
1753 | @@ -683,7 +685,7 @@ |
1754 | def test_publish_binaries(self): |
1755 | # Binary publications result in a PUBLISHED publishing record and |
1756 | # the corresponding files are dumped in the disk pool/. |
1757 | - pub_binary = self.getPubBinaries(filecontent='Hello world')[0] |
1758 | + pub_binary = self.getPubBinaries(filecontent=b'Hello world')[0] |
1759 | pub_binary.publish(self.disk_pool, self.logger) |
1760 | self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_binary.status) |
1761 | pool_path = "%s/main/f/foo/foo-bin_666_all.deb" % self.pool_dir |
1762 | @@ -694,7 +696,7 @@ |
1763 | # Archive.publish_debug_symbols is false just sets PUBLISHED, |
1764 | # without a file in the pool. |
1765 | pubs = self.getPubBinaries( |
1766 | - binaryname='dbg', filecontent='Hello world', with_debug=True) |
1767 | + binaryname='dbg', filecontent=b'Hello world', with_debug=True) |
1768 | |
1769 | def publish_everything(): |
1770 | existence_map = {} |
1771 | @@ -707,13 +709,13 @@ |
1772 | return existence_map |
1773 | |
1774 | self.assertEqual( |
1775 | - {u'dbg_666_all.deb': True, u'dbg-dbgsym_666_all.ddeb': False}, |
1776 | + {'dbg_666_all.deb': True, 'dbg-dbgsym_666_all.ddeb': False}, |
1777 | publish_everything()) |
1778 | |
1779 | pubs[0].archive.publish_debug_symbols = True |
1780 | |
1781 | self.assertEqual( |
1782 | - {u'dbg_666_all.deb': True, u'dbg-dbgsym_666_all.ddeb': True}, |
1783 | + {'dbg_666_all.deb': True, 'dbg-dbgsym_666_all.ddeb': True}, |
1784 | publish_everything()) |
1785 | |
1786 | def testPublishingOverwriteFileInPool(self): |
1787 | @@ -730,7 +732,7 @@ |
1788 | with open(foo_dsc_path, 'w') as foo_dsc: |
1789 | foo_dsc.write('Hello world') |
1790 | |
1791 | - pub_source = self.getPubSource(filecontent="Something") |
1792 | + pub_source = self.getPubSource(filecontent=b"Something") |
1793 | pub_source.publish(self.disk_pool, self.logger) |
1794 | |
1795 | # And an oops should be filed for the error. |
1796 | @@ -742,7 +744,7 @@ |
1797 | |
1798 | def testPublishingDifferentContents(self): |
1799 | """Test if publishOne refuses to overwrite its own publication.""" |
1800 | - pub_source = self.getPubSource(filecontent='foo is happy') |
1801 | + pub_source = self.getPubSource(filecontent=b'foo is happy') |
1802 | pub_source.publish(self.disk_pool, self.logger) |
1803 | self.layer.commit() |
1804 | |
1805 | @@ -754,7 +756,7 @@ |
1806 | # try to publish 'foo' again with a different content, it |
1807 | # raises internally and keeps the files with the original |
1808 | # content. |
1809 | - pub_source2 = self.getPubSource(filecontent='foo is depressing') |
1810 | + pub_source2 = self.getPubSource(filecontent=b'foo is depressing') |
1811 | pub_source2.publish(self.disk_pool, self.logger) |
1812 | self.layer.commit() |
1813 | |
1814 | @@ -769,7 +771,7 @@ |
1815 | mark it as PUBLISHED. |
1816 | """ |
1817 | pub_source = self.getPubSource( |
1818 | - sourcename='bar', filecontent='bar is good') |
1819 | + sourcename='bar', filecontent=b'bar is good') |
1820 | pub_source.publish(self.disk_pool, self.logger) |
1821 | self.layer.commit() |
1822 | bar_name = "%s/main/b/bar/bar_666.dsc" % self.pool_dir |
1823 | @@ -778,7 +780,7 @@ |
1824 | self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED) |
1825 | |
1826 | pub_source2 = self.getPubSource( |
1827 | - sourcename='bar', filecontent='bar is good') |
1828 | + sourcename='bar', filecontent=b'bar is good') |
1829 | pub_source2.publish(self.disk_pool, self.logger) |
1830 | self.layer.commit() |
1831 | pub_source2.sync() |
1832 | @@ -790,7 +792,7 @@ |
1833 | After check if the pool file contents as the same, it should |
1834 | create a symlink in the new pointing to the original file. |
1835 | """ |
1836 | - content = 'am I a file or a symbolic link ?' |
1837 | + content = b'am I a file or a symbolic link ?' |
1838 | # publish sim.dsc in main and re-publish in universe |
1839 | pub_source = self.getPubSource(sourcename='sim', filecontent=content) |
1840 | pub_source2 = self.getPubSource( |
1841 | @@ -813,7 +815,7 @@ |
1842 | # remains pending. |
1843 | pub_source3 = self.getPubSource( |
1844 | sourcename='sim', component='restricted', |
1845 | - filecontent='It is all my fault') |
1846 | + filecontent=b'It is all my fault') |
1847 | pub_source3.publish(self.disk_pool, self.logger) |
1848 | self.layer.commit() |
1849 | |
1850 | @@ -832,7 +834,7 @@ |
1851 | test_disk_pool = DiskPool(test_pool_dir, test_temp_dir, self.logger) |
1852 | |
1853 | pub_source = self.getPubSource( |
1854 | - sourcename="foo", filecontent='Am I a PPA Record ?', |
1855 | + sourcename="foo", filecontent=b'Am I a PPA Record ?', |
1856 | archive=cprov.archive) |
1857 | pub_source.publish(test_disk_pool, self.logger) |
1858 | self.layer.commit() |
1859 | |
1860 | === modified file 'lib/lp/soyuz/tests/test_publishing_models.py' |
1861 | --- lib/lp/soyuz/tests/test_publishing_models.py 2018-01-02 16:10:26 +0000 |
1862 | +++ lib/lp/soyuz/tests/test_publishing_models.py 2018-02-02 10:33:11 +0000 |
1863 | @@ -1,8 +1,10 @@ |
1864 | -# Copyright 2009-2015 Canonical Ltd. This software is licensed under the |
1865 | +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1866 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1867 | |
1868 | """Test model and set utilities used for publishing.""" |
1869 | |
1870 | +from __future__ import absolute_import, print_function, unicode_literals |
1871 | + |
1872 | from zope.component import getUtility |
1873 | from zope.security.proxy import removeSecurityProxy |
1874 | |
1875 | |
1876 | === modified file 'lib/lp/soyuz/tests/test_sourcepackagerelease.py' |
1877 | --- lib/lp/soyuz/tests/test_sourcepackagerelease.py 2018-01-02 16:10:26 +0000 |
1878 | +++ lib/lp/soyuz/tests/test_sourcepackagerelease.py 2018-02-02 10:33:11 +0000 |
1879 | @@ -2,11 +2,13 @@ |
1880 | # NOTE: The first line above must stay first; do not move the copyright |
1881 | # notice to the top. See http://www.python.org/dev/peps/pep-0263/. |
1882 | # |
1883 | -# Copyright 2010-2011 Canonical Ltd. This software is licensed under the |
1884 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1885 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1886 | |
1887 | """Test SourcePackageRelease.""" |
1888 | |
1889 | +from __future__ import absolute_import, print_function, unicode_literals |
1890 | + |
1891 | __metaclass__ = type |
1892 | |
1893 | from textwrap import dedent |
1894 | @@ -76,7 +78,7 @@ |
1895 | # that version and up to and including the context SPR. |
1896 | changelog = self.factory.makeChangelog( |
1897 | spn="foo", versions=["1.3", "1.2", "1.1", "1.0"]) |
1898 | - expected_changelog = dedent(u"""\ |
1899 | + expected_changelog = dedent("""\ |
1900 | foo (1.3) unstable; urgency=low |
1901 | |
1902 | * 1.3. |
1903 | @@ -98,13 +100,13 @@ |
1904 | |
1905 | def test_aggregate_changelog_invalid_utf8(self): |
1906 | # aggregate_changelog copes with invalid UTF-8. |
1907 | - changelog_main = dedent(u"""\ |
1908 | + changelog_main = dedent("""\ |
1909 | foo (1.0) unstable; urgency=low |
1910 | |
1911 | * 1.0 (héllo).""").encode("ISO-8859-1") |
1912 | changelog_trailer = ( |
1913 | - u" -- Føo Bær <foo@example.com> " |
1914 | - u"Tue, 01 Jan 1970 01:50:41 +0000").encode("ISO-8859-1") |
1915 | + " -- Føo Bær <foo@example.com> " |
1916 | + "Tue, 01 Jan 1970 01:50:41 +0000").encode("ISO-8859-1") |
1917 | changelog_text = changelog_main + b"\n\n" + changelog_trailer |
1918 | changelog = self.factory.makeLibraryFileAlias(content=changelog_text) |
1919 | spph = self.factory.makeSourcePackagePublishingHistory( |
1920 | |
1921 | === modified file 'lib/lp/soyuz/tests/test_vocabularies.py' |
1922 | --- lib/lp/soyuz/tests/test_vocabularies.py 2014-08-08 17:27:07 +0000 |
1923 | +++ lib/lp/soyuz/tests/test_vocabularies.py 2018-02-02 10:33:11 +0000 |
1924 | @@ -1,8 +1,10 @@ |
1925 | -# Copyright 2012-2014 Canonical Ltd. This software is licensed under the |
1926 | +# Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
1927 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1928 | |
1929 | """Test Soyuz vocabularies.""" |
1930 | |
1931 | +from __future__ import absolute_import, print_function, unicode_literals |
1932 | + |
1933 | __metaclass__ = type |
1934 | |
1935 | from testtools.matchers import MatchesStructure |
1936 | |
1937 | === modified file 'lib/lp/soyuz/tests/test_yuitests.py' |
1938 | --- lib/lp/soyuz/tests/test_yuitests.py 2012-01-01 02:58:52 +0000 |
1939 | +++ lib/lp/soyuz/tests/test_yuitests.py 2018-02-02 10:33:11 +0000 |
1940 | @@ -1,8 +1,10 @@ |
1941 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
1942 | +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
1943 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1944 | |
1945 | """Run YUI.test tests.""" |
1946 | |
1947 | +from __future__ import absolute_import, print_function, unicode_literals |
1948 | + |
1949 | __metaclass__ = type |
1950 | __all__ = [] |
1951 |