Merge ~cjwatson/launchpad:pyupgrade-py3-coop-oci into launchpad:master
- Git
- lp:~cjwatson/launchpad
- pyupgrade-py3-coop-oci
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | f2edab727f50c25f1e84aa13c4bd7b39cf5200a6 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:pyupgrade-py3-coop-oci |
Merge into: | launchpad:master |
Diff against target: |
1076 lines (+110/-116) 29 files modified
.git-blame-ignore-revs (+2/-0) .pre-commit-config.yaml (+2/-0) lib/lp/coop/answersbugs/tests/test_doc.py (+2/-2) lib/lp/oci/browser/ocirecipe.py (+20/-21) lib/lp/oci/browser/ocirecipebuild.py (+1/-1) lib/lp/oci/browser/ocirecipesubscription.py (+2/-2) lib/lp/oci/browser/tests/test_ocirecipe.py (+11/-11) lib/lp/oci/browser/tests/test_ocirecipebuild.py (+3/-3) lib/lp/oci/browser/tests/test_ocirecipesubscription.py (+1/-1) lib/lp/oci/interfaces/ocipushrule.py (+1/-1) lib/lp/oci/interfaces/ocirecipe.py (+7/-8) lib/lp/oci/interfaces/ociregistryclient.py (+1/-1) lib/lp/oci/interfaces/ociregistrycredentials.py (+1/-1) lib/lp/oci/model/ocirecipe.py (+2/-4) lib/lp/oci/model/ocirecipebuild.py (+2/-2) lib/lp/oci/model/ocirecipebuildbehaviour.py (+2/-3) lib/lp/oci/model/ocirecipebuildjob.py (+3/-3) lib/lp/oci/model/ocirecipejob.py (+2/-2) lib/lp/oci/model/ocirecipesubscription.py (+1/-1) lib/lp/oci/model/ociregistryclient.py (+3/-3) lib/lp/oci/tests/helpers.py (+1/-1) lib/lp/oci/tests/test_ocipushrule.py (+2/-2) lib/lp/oci/tests/test_ocirecipe.py (+11/-14) lib/lp/oci/tests/test_ocirecipebuild.py (+7/-8) lib/lp/oci/tests/test_ocirecipebuildbehaviour.py (+6/-6) lib/lp/oci/tests/test_ocirecipebuildjob.py (+5/-6) lib/lp/oci/tests/test_ocirecipejob.py (+1/-1) lib/lp/oci/tests/test_ociregistryclient.py (+6/-6) lib/lp/oci/tests/test_ociregistrycredentials.py (+2/-2) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+413412@code.launchpad.net |
Commit message
lp.{coop,oci}: Apply "pyupgrade --py3-plus"
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs | |||
2 | index 2e06d20..a251b8f 100644 | |||
3 | --- a/.git-blame-ignore-revs | |||
4 | +++ b/.git-blame-ignore-revs | |||
5 | @@ -26,3 +26,5 @@ b6725842a2470e3927bb73bf400c4476a06ee3ba | |||
6 | 26 | cee9b128d3e49ca814464eeeeec50e6bcabcc4ba | 26 | cee9b128d3e49ca814464eeeeec50e6bcabcc4ba |
7 | 27 | # apply pyupgrade --py3-plus to lp.codehosting | 27 | # apply pyupgrade --py3-plus to lp.codehosting |
8 | 28 | f36fe66e5e5a5e82ba8c3269e32d76bd573d1175 | 28 | f36fe66e5e5a5e82ba8c3269e32d76bd573d1175 |
9 | 29 | # apply pyupgrade --py3-plus to lp.{coop,oci} | ||
10 | 30 | fbed83f22424df8fa5647349493f78937a520db5 | ||
11 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml | |||
12 | index 77a3d08..22c2329 100644 | |||
13 | --- a/.pre-commit-config.yaml | |||
14 | +++ b/.pre-commit-config.yaml | |||
15 | @@ -50,6 +50,8 @@ repos: | |||
16 | 50 | |charms | 50 | |charms |
17 | 51 | |code | 51 | |code |
18 | 52 | |codehosting | 52 | |codehosting |
19 | 53 | |coop | ||
20 | 54 | |oci | ||
21 | 53 | )/ | 55 | )/ |
22 | 54 | - repo: https://github.com/PyCQA/isort | 56 | - repo: https://github.com/PyCQA/isort |
23 | 55 | rev: 5.9.2 | 57 | rev: 5.9.2 |
24 | diff --git a/lib/lp/coop/answersbugs/tests/test_doc.py b/lib/lp/coop/answersbugs/tests/test_doc.py | |||
25 | index a917db1..a3e2eb0 100644 | |||
26 | --- a/lib/lp/coop/answersbugs/tests/test_doc.py | |||
27 | +++ b/lib/lp/coop/answersbugs/tests/test_doc.py | |||
28 | @@ -54,8 +54,8 @@ def _createUbuntuBugTaskLinkedToQuestion(): | |||
29 | 54 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | 54 | ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
30 | 55 | ubuntu.addAnswerContact(ubuntu_team, ubuntu_team.teamowner) | 55 | ubuntu.addAnswerContact(ubuntu_team, ubuntu_team.teamowner) |
31 | 56 | ubuntu_question = ubuntu.newQuestion( | 56 | ubuntu_question = ubuntu.newQuestion( |
34 | 57 | sample_person, u"Can't install Ubuntu", | 57 | sample_person, "Can't install Ubuntu", |
35 | 58 | u"I insert the install CD in the CD-ROM drive, but it won't boot.") | 58 | "I insert the install CD in the CD-ROM drive, but it won't boot.") |
36 | 59 | no_priv = getUtility(IPersonSet).getByEmail('no-priv@canonical.com') | 59 | no_priv = getUtility(IPersonSet).getByEmail('no-priv@canonical.com') |
37 | 60 | params = CreateBugParams( | 60 | params = CreateBugParams( |
38 | 61 | owner=no_priv, title="Installer fails on a Mac PPC", | 61 | owner=no_priv, title="Installer fails on a Mac PPC", |
39 | diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py | |||
40 | index 3b12dff..7329652 100644 | |||
41 | --- a/lib/lp/oci/browser/ocirecipe.py | |||
42 | +++ b/lib/lp/oci/browser/ocirecipe.py | |||
43 | @@ -20,7 +20,6 @@ from lazr.restful.interface import ( | |||
44 | 20 | copy_field, | 20 | copy_field, |
45 | 21 | use_template, | 21 | use_template, |
46 | 22 | ) | 22 | ) |
47 | 23 | import six | ||
48 | 24 | from zope.component import getUtility | 23 | from zope.component import getUtility |
49 | 25 | from zope.formlib.form import FormFields | 24 | from zope.formlib.form import FormFields |
50 | 26 | from zope.formlib.textwidgets import TextAreaWidget | 25 | from zope.formlib.textwidgets import TextAreaWidget |
51 | @@ -448,7 +447,7 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): | |||
52 | 448 | return field_type, rule_id | 447 | return field_type, rule_id |
53 | 449 | 448 | ||
54 | 450 | def setUpFields(self): | 449 | def setUpFields(self): |
56 | 451 | super(OCIRecipeEditPushRulesView, self).setUpFields() | 450 | super().setUpFields() |
57 | 452 | image_name_fields = [] | 451 | image_name_fields = [] |
58 | 453 | url_fields = [] | 452 | url_fields = [] |
59 | 454 | region_fields = [] | 453 | region_fields = [] |
60 | @@ -510,7 +509,7 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): | |||
61 | 510 | required=True, readonly=False)) | 509 | required=True, readonly=False)) |
62 | 511 | image_name_fields.append( | 510 | image_name_fields.append( |
63 | 512 | TextLine( | 511 | TextLine( |
65 | 513 | __name__=u'add_image_name', | 512 | __name__='add_image_name', |
66 | 514 | required=False, readonly=False)) | 513 | required=False, readonly=False)) |
67 | 515 | add_credentials = Choice( | 514 | add_credentials = Choice( |
68 | 516 | __name__='add_credentials', | 515 | __name__='add_credentials', |
69 | @@ -519,26 +518,26 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): | |||
70 | 519 | existing_credentials = Choice( | 518 | existing_credentials = Choice( |
71 | 520 | vocabulary='OCIRegistryCredentials', | 519 | vocabulary='OCIRegistryCredentials', |
72 | 521 | required=False, | 520 | required=False, |
74 | 522 | __name__=u'existing_credentials') | 521 | __name__='existing_credentials') |
75 | 523 | url_fields.append( | 522 | url_fields.append( |
76 | 524 | TextLine( | 523 | TextLine( |
78 | 525 | __name__=u'add_url', | 524 | __name__='add_url', |
79 | 526 | required=False, readonly=False)) | 525 | required=False, readonly=False)) |
80 | 527 | region_fields.append( | 526 | region_fields.append( |
81 | 528 | TextLine( | 527 | TextLine( |
83 | 529 | __name__=u'add_region', | 528 | __name__='add_region', |
84 | 530 | required=False, readonly=False)) | 529 | required=False, readonly=False)) |
85 | 531 | username_fields.append( | 530 | username_fields.append( |
86 | 532 | TextLine( | 531 | TextLine( |
88 | 533 | __name__=u'add_username', | 532 | __name__='add_username', |
89 | 534 | required=False, readonly=False)) | 533 | required=False, readonly=False)) |
90 | 535 | password_fields.append( | 534 | password_fields.append( |
91 | 536 | Password( | 535 | Password( |
93 | 537 | __name__=u'add_password', | 536 | __name__='add_password', |
94 | 538 | required=False, readonly=False)) | 537 | required=False, readonly=False)) |
95 | 539 | password_fields.append( | 538 | password_fields.append( |
96 | 540 | Password( | 539 | Password( |
98 | 541 | __name__=u'add_confirm_password', | 540 | __name__='add_confirm_password', |
99 | 542 | required=False, readonly=False)) | 541 | required=False, readonly=False)) |
100 | 543 | 542 | ||
101 | 544 | self.form_fields = ( | 543 | self.form_fields = ( |
102 | @@ -561,7 +560,7 @@ class OCIRecipeEditPushRulesView(LaunchpadFormView): | |||
103 | 561 | 560 | ||
104 | 562 | def setUpWidgets(self, context=None): | 561 | def setUpWidgets(self, context=None): |
105 | 563 | """See `LaunchpadFormView`.""" | 562 | """See `LaunchpadFormView`.""" |
107 | 564 | super(OCIRecipeEditPushRulesView, self).setUpWidgets(context=context) | 563 | super().setUpWidgets(context=context) |
108 | 565 | for widget in self.widgets: | 564 | for widget in self.widgets: |
109 | 566 | widget.display_label = False | 565 | widget.display_label = False |
110 | 567 | widget.hint = None | 566 | widget.hint = None |
111 | @@ -846,7 +845,7 @@ class OCIRecipeFormMixin: | |||
112 | 846 | default = "" | 845 | default = "" |
113 | 847 | return FormFields(Text( | 846 | return FormFields(Text( |
114 | 848 | __name__='build_args', | 847 | __name__='build_args', |
116 | 849 | title=u'Build-time ARG variables', | 848 | title='Build-time ARG variables', |
117 | 850 | description=("One per line. Each ARG should be in the format " | 849 | description=("One per line. Each ARG should be in the format " |
118 | 851 | "of ARG_KEY=arg_value."), | 850 | "of ARG_KEY=arg_value."), |
119 | 852 | default=default, | 851 | default=default, |
120 | @@ -861,7 +860,7 @@ class OCIRecipeFormMixin: | |||
121 | 861 | if '=' not in line: | 860 | if '=' not in line: |
122 | 862 | msg = ("'%s' at line %s is not a valid KEY=value pair." % | 861 | msg = ("'%s' at line %s is not a valid KEY=value pair." % |
123 | 863 | (line, i + 1)) | 862 | (line, i + 1)) |
125 | 864 | self.setFieldError("build_args", six.text_type(msg)) | 863 | self.setFieldError("build_args", str(msg)) |
126 | 865 | return | 864 | return |
127 | 866 | k, v = line.split('=', 1) | 865 | k, v = line.split('=', 1) |
128 | 867 | build_args[k] = v | 866 | build_args[k] = v |
129 | @@ -919,13 +918,13 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, | |||
130 | 919 | custom_widget_git_ref = GitRefWidget | 918 | custom_widget_git_ref = GitRefWidget |
131 | 920 | 919 | ||
132 | 921 | def initialize(self): | 920 | def initialize(self): |
134 | 922 | super(OCIRecipeAddView, self).initialize() | 921 | super().initialize() |
135 | 923 | if not getFeatureFlag(OCI_RECIPE_ALLOW_CREATE): | 922 | if not getFeatureFlag(OCI_RECIPE_ALLOW_CREATE): |
136 | 924 | raise OCIRecipeFeatureDisabled() | 923 | raise OCIRecipeFeatureDisabled() |
137 | 925 | 924 | ||
138 | 926 | def setUpFields(self): | 925 | def setUpFields(self): |
139 | 927 | """See `LaunchpadFormView`.""" | 926 | """See `LaunchpadFormView`.""" |
141 | 928 | super(OCIRecipeAddView, self).setUpFields() | 927 | super().setUpFields() |
142 | 929 | self.form_fields += self.createBuildArgsField() | 928 | self.form_fields += self.createBuildArgsField() |
143 | 930 | self.form_fields += self.createEnabledProcessors( | 929 | self.form_fields += self.createEnabledProcessors( |
144 | 931 | getUtility(IProcessorSet).getAll(), | 930 | getUtility(IProcessorSet).getAll(), |
145 | @@ -945,7 +944,7 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, | |||
146 | 945 | if self.distribution_has_credentials: | 944 | if self.distribution_has_credentials: |
147 | 946 | self.form_fields += FormFields(TextLine( | 945 | self.form_fields += FormFields(TextLine( |
148 | 947 | __name__='image_name', | 946 | __name__='image_name', |
150 | 948 | title=u"Image name", | 947 | title="Image name", |
151 | 949 | description=( | 948 | description=( |
152 | 950 | "Name to use for registry upload. " | 949 | "Name to use for registry upload. " |
153 | 951 | "Defaults to the name of the recipe."), | 950 | "Defaults to the name of the recipe."), |
154 | @@ -976,7 +975,7 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, | |||
155 | 976 | 975 | ||
156 | 977 | def setUpWidgets(self): | 976 | def setUpWidgets(self): |
157 | 978 | """See `LaunchpadFormView`.""" | 977 | """See `LaunchpadFormView`.""" |
159 | 979 | super(OCIRecipeAddView, self).setUpWidgets() | 978 | super().setUpWidgets() |
160 | 980 | self.setUpInformationTypeWidget() | 979 | self.setUpInformationTypeWidget() |
161 | 981 | self.widgets["processors"].widget_class = "processors" | 980 | self.widgets["processors"].widget_class = "processors" |
162 | 982 | self.setUpGitRefWidget() | 981 | self.setUpGitRefWidget() |
163 | @@ -1005,7 +1004,7 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin, | |||
164 | 1005 | 1004 | ||
165 | 1006 | def validate(self, data): | 1005 | def validate(self, data): |
166 | 1007 | """See `LaunchpadFormView`.""" | 1006 | """See `LaunchpadFormView`.""" |
168 | 1008 | super(OCIRecipeAddView, self).validate(data) | 1007 | super().validate(data) |
169 | 1009 | owner = data.get("owner", None) | 1008 | owner = data.get("owner", None) |
170 | 1010 | name = data.get("name", None) | 1009 | name = data.get("name", None) |
171 | 1011 | if owner and name: | 1010 | if owner and name: |
172 | @@ -1137,7 +1136,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, | |||
173 | 1137 | 1136 | ||
174 | 1138 | def setUpWidgets(self): | 1137 | def setUpWidgets(self): |
175 | 1139 | """See `LaunchpadFormView`.""" | 1138 | """See `LaunchpadFormView`.""" |
177 | 1140 | super(OCIRecipeEditView, self).setUpWidgets() | 1139 | super().setUpWidgets() |
178 | 1141 | self.setUpInformationTypeWidget() | 1140 | self.setUpInformationTypeWidget() |
179 | 1142 | self.setUpGitRefWidget() | 1141 | self.setUpGitRefWidget() |
180 | 1143 | # disable the official recipe button if the user doesn't have | 1142 | # disable the official recipe button if the user doesn't have |
181 | @@ -1148,7 +1147,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, | |||
182 | 1148 | 1147 | ||
183 | 1149 | def setUpFields(self): | 1148 | def setUpFields(self): |
184 | 1150 | """See `LaunchpadFormView`.""" | 1149 | """See `LaunchpadFormView`.""" |
186 | 1151 | super(OCIRecipeEditView, self).setUpFields() | 1150 | super().setUpFields() |
187 | 1152 | self.form_fields += self.createBuildArgsField() | 1151 | self.form_fields += self.createBuildArgsField() |
188 | 1153 | self.form_fields += self.createEnabledProcessors( | 1152 | self.form_fields += self.createEnabledProcessors( |
189 | 1154 | self.context.available_processors, | 1153 | self.context.available_processors, |
190 | @@ -1168,7 +1167,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, | |||
191 | 1168 | if self.distribution_has_credentials: | 1167 | if self.distribution_has_credentials: |
192 | 1169 | self.form_fields += FormFields(TextLine( | 1168 | self.form_fields += FormFields(TextLine( |
193 | 1170 | __name__='image_name', | 1169 | __name__='image_name', |
195 | 1171 | title=u"Image name", | 1170 | title="Image name", |
196 | 1172 | description=( | 1171 | description=( |
197 | 1173 | "Name to use for registry upload. " | 1172 | "Name to use for registry upload. " |
198 | 1174 | "Defaults to the name of the recipe."), | 1173 | "Defaults to the name of the recipe."), |
199 | @@ -1177,7 +1176,7 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin, | |||
200 | 1177 | 1176 | ||
201 | 1178 | def validate(self, data): | 1177 | def validate(self, data): |
202 | 1179 | """See `LaunchpadFormView`.""" | 1178 | """See `LaunchpadFormView`.""" |
204 | 1180 | super(OCIRecipeEditView, self).validate(data) | 1179 | super().validate(data) |
205 | 1181 | # XXX cjwatson 2020-02-18: We should permit and check moving recipes | 1180 | # XXX cjwatson 2020-02-18: We should permit and check moving recipes |
206 | 1182 | # between OCI projects too. | 1181 | # between OCI projects too. |
207 | 1183 | owner = data.get("owner", None) | 1182 | owner = data.get("owner", None) |
208 | diff --git a/lib/lp/oci/browser/ocirecipebuild.py b/lib/lp/oci/browser/ocirecipebuild.py | |||
209 | index bdc63ad..9f1d55e 100644 | |||
210 | --- a/lib/lp/oci/browser/ocirecipebuild.py | |||
211 | +++ b/lib/lp/oci/browser/ocirecipebuild.py | |||
212 | @@ -166,7 +166,7 @@ class OCIRecipeBuildRescoreView(LaunchpadFormView): | |||
213 | 166 | 166 | ||
214 | 167 | def __call__(self): | 167 | def __call__(self): |
215 | 168 | if self.context.can_be_rescored: | 168 | if self.context.can_be_rescored: |
217 | 169 | return super(OCIRecipeBuildRescoreView, self).__call__() | 169 | return super().__call__() |
218 | 170 | self.request.response.addWarningNotification( | 170 | self.request.response.addWarningNotification( |
219 | 171 | "Cannot rescore this build because it is not queued.") | 171 | "Cannot rescore this build because it is not queued.") |
220 | 172 | self.request.response.redirect(canonical_url(self.context)) | 172 | self.request.response.redirect(canonical_url(self.context)) |
221 | diff --git a/lib/lp/oci/browser/ocirecipesubscription.py b/lib/lp/oci/browser/ocirecipesubscription.py | |||
222 | index 4edf12e..c4f016f 100644 | |||
223 | --- a/lib/lp/oci/browser/ocirecipesubscription.py | |||
224 | +++ b/lib/lp/oci/browser/ocirecipesubscription.py | |||
225 | @@ -94,7 +94,7 @@ class OCIRecipeSubscriptionEditView(RedirectToOCIRecipeMixin, | |||
226 | 94 | def initialize(self): | 94 | def initialize(self): |
227 | 95 | self.ocirecipe = self.context.recipe | 95 | self.ocirecipe = self.context.recipe |
228 | 96 | self.person = self.context.person | 96 | self.person = self.context.person |
230 | 97 | super(OCIRecipeSubscriptionEditView, self).initialize() | 97 | super().initialize() |
231 | 98 | 98 | ||
232 | 99 | @action("Unsubscribe", name="unsubscribe") | 99 | @action("Unsubscribe", name="unsubscribe") |
233 | 100 | def unsubscribe_action(self, action, data): | 100 | def unsubscribe_action(self, action, data): |
234 | @@ -114,7 +114,7 @@ class _OCIRecipeSubscriptionCreationView(RedirectToOCIRecipeMixin, | |||
235 | 114 | 114 | ||
236 | 115 | def initialize(self): | 115 | def initialize(self): |
237 | 116 | self.ocirecipe = self.context | 116 | self.ocirecipe = self.context |
239 | 117 | super(_OCIRecipeSubscriptionCreationView, self).initialize() | 117 | super().initialize() |
240 | 118 | 118 | ||
241 | 119 | 119 | ||
242 | 120 | class OCIRecipeSubscriptionAddView(_OCIRecipeSubscriptionCreationView): | 120 | class OCIRecipeSubscriptionAddView(_OCIRecipeSubscriptionCreationView): |
243 | diff --git a/lib/lp/oci/browser/tests/test_ocirecipe.py b/lib/lp/oci/browser/tests/test_ocirecipe.py | |||
244 | index 0479b15..9b17ee7 100644 | |||
245 | --- a/lib/lp/oci/browser/tests/test_ocirecipe.py | |||
246 | +++ b/lib/lp/oci/browser/tests/test_ocirecipe.py | |||
247 | @@ -101,7 +101,7 @@ class TestOCIRecipeNavigation(TestCaseWithFactory): | |||
248 | 101 | layer = DatabaseFunctionalLayer | 101 | layer = DatabaseFunctionalLayer |
249 | 102 | 102 | ||
250 | 103 | def setUp(self): | 103 | def setUp(self): |
252 | 104 | super(TestOCIRecipeNavigation, self).setUp() | 104 | super().setUp() |
253 | 105 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 105 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
254 | 106 | 106 | ||
255 | 107 | def test_canonical_url(self): | 107 | def test_canonical_url(self): |
256 | @@ -144,7 +144,7 @@ class BaseTestOCIRecipeView(BrowserTestCase): | |||
257 | 144 | layer = LaunchpadFunctionalLayer | 144 | layer = LaunchpadFunctionalLayer |
258 | 145 | 145 | ||
259 | 146 | def setUp(self): | 146 | def setUp(self): |
261 | 147 | super(BaseTestOCIRecipeView, self).setUp() | 147 | super().setUp() |
262 | 148 | self.useFixture(FakeLogger()) | 148 | self.useFixture(FakeLogger()) |
263 | 149 | self.person = self.factory.makePerson( | 149 | self.person = self.factory.makePerson( |
264 | 150 | name="test-person", displayname="Test Person") | 150 | name="test-person", displayname="Test Person") |
265 | @@ -153,7 +153,7 @@ class BaseTestOCIRecipeView(BrowserTestCase): | |||
266 | 153 | class TestOCIRecipeAddView(OCIConfigHelperMixin, BaseTestOCIRecipeView): | 153 | class TestOCIRecipeAddView(OCIConfigHelperMixin, BaseTestOCIRecipeView): |
267 | 154 | 154 | ||
268 | 155 | def setUp(self): | 155 | def setUp(self): |
270 | 156 | super(TestOCIRecipeAddView, self).setUp() | 156 | super().setUp() |
271 | 157 | self.distroseries = self.factory.makeDistroSeries() | 157 | self.distroseries = self.factory.makeDistroSeries() |
272 | 158 | self.distribution = self.distroseries.distribution | 158 | self.distribution = self.distroseries.distribution |
273 | 159 | self.useFixture(FeatureFixture({ | 159 | self.useFixture(FeatureFixture({ |
274 | @@ -539,7 +539,7 @@ class TestOCIRecipeAddView(OCIConfigHelperMixin, BaseTestOCIRecipeView): | |||
275 | 539 | class TestOCIRecipeAdminView(BaseTestOCIRecipeView): | 539 | class TestOCIRecipeAdminView(BaseTestOCIRecipeView): |
276 | 540 | 540 | ||
277 | 541 | def setUp(self): | 541 | def setUp(self): |
279 | 542 | super(TestOCIRecipeAdminView, self).setUp() | 542 | super().setUp() |
280 | 543 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 543 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
281 | 544 | 544 | ||
282 | 545 | def test_unauthorized(self): | 545 | def test_unauthorized(self): |
283 | @@ -594,7 +594,7 @@ class TestOCIRecipeAdminView(BaseTestOCIRecipeView): | |||
284 | 594 | class TestOCIRecipeEditView(OCIConfigHelperMixin, BaseTestOCIRecipeView): | 594 | class TestOCIRecipeEditView(OCIConfigHelperMixin, BaseTestOCIRecipeView): |
285 | 595 | 595 | ||
286 | 596 | def setUp(self): | 596 | def setUp(self): |
288 | 597 | super(TestOCIRecipeEditView, self).setUp() | 597 | super().setUp() |
289 | 598 | self.distroseries = self.factory.makeDistroSeries() | 598 | self.distroseries = self.factory.makeDistroSeries() |
290 | 599 | self.distribution = self.distroseries.distribution | 599 | self.distribution = self.distroseries.distribution |
291 | 600 | self.useFixture(FeatureFixture({ | 600 | self.useFixture(FeatureFixture({ |
292 | @@ -1140,7 +1140,7 @@ class TestOCIRecipeEditView(OCIConfigHelperMixin, BaseTestOCIRecipeView): | |||
293 | 1140 | class TestOCIRecipeDeleteView(BaseTestOCIRecipeView): | 1140 | class TestOCIRecipeDeleteView(BaseTestOCIRecipeView): |
294 | 1141 | 1141 | ||
295 | 1142 | def setUp(self): | 1142 | def setUp(self): |
297 | 1143 | super(TestOCIRecipeDeleteView, self).setUp() | 1143 | super().setUp() |
298 | 1144 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 1144 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
299 | 1145 | 1145 | ||
300 | 1146 | def test_unauthorized(self): | 1146 | def test_unauthorized(self): |
301 | @@ -1208,7 +1208,7 @@ class TestOCIRecipeDeleteView(BaseTestOCIRecipeView): | |||
302 | 1208 | class TestOCIRecipeView(BaseTestOCIRecipeView): | 1208 | class TestOCIRecipeView(BaseTestOCIRecipeView): |
303 | 1209 | 1209 | ||
304 | 1210 | def setUp(self): | 1210 | def setUp(self): |
306 | 1211 | super(TestOCIRecipeView, self).setUp() | 1211 | super().setUp() |
307 | 1212 | self.distroseries = self.factory.makeDistroSeries() | 1212 | self.distroseries = self.factory.makeDistroSeries() |
308 | 1213 | processor = getUtility(IProcessorSet).getByName("386") | 1213 | processor = getUtility(IProcessorSet).getByName("386") |
309 | 1214 | self.distroarchseries = self.factory.makeDistroArchSeries( | 1214 | self.distroarchseries = self.factory.makeDistroArchSeries( |
310 | @@ -1721,7 +1721,7 @@ class TestOCIRecipeView(BaseTestOCIRecipeView): | |||
311 | 1721 | class TestOCIRecipeRequestBuildsView(BaseTestOCIRecipeView): | 1721 | class TestOCIRecipeRequestBuildsView(BaseTestOCIRecipeView): |
312 | 1722 | 1722 | ||
313 | 1723 | def setUp(self): | 1723 | def setUp(self): |
315 | 1724 | super(TestOCIRecipeRequestBuildsView, self).setUp() | 1724 | super().setUp() |
316 | 1725 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 1725 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
317 | 1726 | self.distroseries = self.factory.makeDistroSeries( | 1726 | self.distroseries = self.factory.makeDistroSeries( |
318 | 1727 | distribution=self.ubuntu, name="shiny", displayname="Shiny") | 1727 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
319 | @@ -1802,7 +1802,7 @@ class TestOCIRecipeRequestBuildsView(BaseTestOCIRecipeView): | |||
320 | 1802 | class TestOCIRecipeEditPushRulesView(OCIConfigHelperMixin, | 1802 | class TestOCIRecipeEditPushRulesView(OCIConfigHelperMixin, |
321 | 1803 | BaseTestOCIRecipeView): | 1803 | BaseTestOCIRecipeView): |
322 | 1804 | def setUp(self): | 1804 | def setUp(self): |
324 | 1805 | super(TestOCIRecipeEditPushRulesView, self).setUp() | 1805 | super().setUp() |
325 | 1806 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 1806 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
326 | 1807 | self.distroseries = self.factory.makeDistroSeries( | 1807 | self.distroseries = self.factory.makeDistroSeries( |
327 | 1808 | distribution=self.ubuntu, name="shiny", displayname="Shiny") | 1808 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
328 | @@ -2232,7 +2232,7 @@ class TestOCIRecipeEditPushRulesView(OCIConfigHelperMixin, | |||
329 | 2232 | self.assertEqual(len(rules), 1) | 2232 | self.assertEqual(len(rules), 1) |
330 | 2233 | rule = rules[0] | 2233 | rule = rules[0] |
331 | 2234 | self.assertThat(rule, MatchesStructure( | 2234 | self.assertThat(rule, MatchesStructure( |
333 | 2235 | image_name=Equals(u'imagename1'), | 2235 | image_name=Equals('imagename1'), |
334 | 2236 | registry_url=Equals(url), | 2236 | registry_url=Equals(url), |
335 | 2237 | registry_credentials=MatchesStructure( | 2237 | registry_credentials=MatchesStructure( |
336 | 2238 | url=Equals(url), | 2238 | url=Equals(url), |
337 | @@ -2325,7 +2325,7 @@ class TestOCIRecipeEditPushRulesView(OCIConfigHelperMixin, | |||
338 | 2325 | 2325 | ||
339 | 2326 | class TestOCIRecipeListingView(BaseTestOCIRecipeView): | 2326 | class TestOCIRecipeListingView(BaseTestOCIRecipeView): |
340 | 2327 | def setUp(self): | 2327 | def setUp(self): |
342 | 2328 | super(TestOCIRecipeListingView, self).setUp() | 2328 | super().setUp() |
343 | 2329 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu | 2329 | self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu |
344 | 2330 | self.distroseries = self.factory.makeDistroSeries( | 2330 | self.distroseries = self.factory.makeDistroSeries( |
345 | 2331 | distribution=self.ubuntu, name="shiny", displayname="Shiny") | 2331 | distribution=self.ubuntu, name="shiny", displayname="Shiny") |
346 | diff --git a/lib/lp/oci/browser/tests/test_ocirecipebuild.py b/lib/lp/oci/browser/tests/test_ocirecipebuild.py | |||
347 | index 7fa823e..2466f85 100644 | |||
348 | --- a/lib/lp/oci/browser/tests/test_ocirecipebuild.py | |||
349 | +++ b/lib/lp/oci/browser/tests/test_ocirecipebuild.py | |||
350 | @@ -46,7 +46,7 @@ class TestCanonicalUrlForOCIRecipeBuild(TestCaseWithFactory): | |||
351 | 46 | layer = DatabaseFunctionalLayer | 46 | layer = DatabaseFunctionalLayer |
352 | 47 | 47 | ||
353 | 48 | def setUp(self): | 48 | def setUp(self): |
355 | 49 | super(TestCanonicalUrlForOCIRecipeBuild, self).setUp() | 49 | super().setUp() |
356 | 50 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 50 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
357 | 51 | 51 | ||
358 | 52 | def test_canonical_url(self): | 52 | def test_canonical_url(self): |
359 | @@ -70,7 +70,7 @@ class TestOCIRecipeBuildView(BrowserTestCase): | |||
360 | 70 | layer = LaunchpadFunctionalLayer | 70 | layer = LaunchpadFunctionalLayer |
361 | 71 | 71 | ||
362 | 72 | def setUp(self): | 72 | def setUp(self): |
364 | 73 | super(TestOCIRecipeBuildView, self).setUp() | 73 | super().setUp() |
365 | 74 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 74 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
366 | 75 | 75 | ||
367 | 76 | def test_index(self): | 76 | def test_index(self): |
368 | @@ -157,7 +157,7 @@ class TestOCIRecipeBuildOperations(BrowserTestCase): | |||
369 | 157 | layer = DatabaseFunctionalLayer | 157 | layer = DatabaseFunctionalLayer |
370 | 158 | 158 | ||
371 | 159 | def setUp(self): | 159 | def setUp(self): |
373 | 160 | super(TestOCIRecipeBuildOperations, self).setUp() | 160 | super().setUp() |
374 | 161 | self.useFixture(FakeLogger()) | 161 | self.useFixture(FakeLogger()) |
375 | 162 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 162 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
376 | 163 | self.build = self.factory.makeOCIRecipeBuild() | 163 | self.build = self.factory.makeOCIRecipeBuild() |
377 | diff --git a/lib/lp/oci/browser/tests/test_ocirecipesubscription.py b/lib/lp/oci/browser/tests/test_ocirecipesubscription.py | |||
378 | index 41b76b9..fbd60d6 100644 | |||
379 | --- a/lib/lp/oci/browser/tests/test_ocirecipesubscription.py | |||
380 | +++ b/lib/lp/oci/browser/tests/test_ocirecipesubscription.py | |||
381 | @@ -29,7 +29,7 @@ class BaseTestOCIRecipeView(OCIConfigHelperMixin, BrowserTestCase): | |||
382 | 29 | layer = DatabaseFunctionalLayer | 29 | layer = DatabaseFunctionalLayer |
383 | 30 | 30 | ||
384 | 31 | def setUp(self): | 31 | def setUp(self): |
386 | 32 | super(BaseTestOCIRecipeView, self).setUp() | 32 | super().setUp() |
387 | 33 | self.setConfig() | 33 | self.setConfig() |
388 | 34 | self.useFixture(FakeLogger()) | 34 | self.useFixture(FakeLogger()) |
389 | 35 | self.person = self.factory.makePerson(name='recipe-owner') | 35 | self.person = self.factory.makePerson(name='recipe-owner') |
390 | diff --git a/lib/lp/oci/interfaces/ocipushrule.py b/lib/lp/oci/interfaces/ocipushrule.py | |||
391 | index 5619875..9c800fa 100644 | |||
392 | --- a/lib/lp/oci/interfaces/ocipushrule.py | |||
393 | +++ b/lib/lp/oci/interfaces/ocipushrule.py | |||
394 | @@ -40,7 +40,7 @@ class OCIPushRuleAlreadyExists(Exception): | |||
395 | 40 | """ | 40 | """ |
396 | 41 | 41 | ||
397 | 42 | def __init__(self): | 42 | def __init__(self): |
399 | 43 | super(OCIPushRuleAlreadyExists, self).__init__( | 43 | super().__init__( |
400 | 44 | "A push rule already exists with the same URL, image name, " | 44 | "A push rule already exists with the same URL, image name, " |
401 | 45 | "and credentials") | 45 | "and credentials") |
402 | 46 | 46 | ||
403 | diff --git a/lib/lp/oci/interfaces/ocirecipe.py b/lib/lp/oci/interfaces/ocirecipe.py | |||
404 | index 47fffe7..2a7256c 100644 | |||
405 | --- a/lib/lp/oci/interfaces/ocirecipe.py | |||
406 | +++ b/lib/lp/oci/interfaces/ocirecipe.py | |||
407 | @@ -94,7 +94,7 @@ class OCIRecipeFeatureDisabled(Unauthorized): | |||
408 | 94 | """Only certain users can create new OCI recipes.""" | 94 | """Only certain users can create new OCI recipes.""" |
409 | 95 | 95 | ||
410 | 96 | def __init__(self): | 96 | def __init__(self): |
412 | 97 | super(OCIRecipeFeatureDisabled, self).__init__( | 97 | super().__init__( |
413 | 98 | "You do not have permission to create new OCI recipes.") | 98 | "You do not have permission to create new OCI recipes.") |
414 | 99 | 99 | ||
415 | 100 | 100 | ||
416 | @@ -108,7 +108,7 @@ class OCIRecipeBuildAlreadyPending(Exception): | |||
417 | 108 | """A build was requested when an identical build was already pending.""" | 108 | """A build was requested when an identical build was already pending.""" |
418 | 109 | 109 | ||
419 | 110 | def __init__(self): | 110 | def __init__(self): |
421 | 111 | super(OCIRecipeBuildAlreadyPending, self).__init__( | 111 | super().__init__( |
422 | 112 | "An identical build of this OCI recipe is already pending.") | 112 | "An identical build of this OCI recipe is already pending.") |
423 | 113 | 113 | ||
424 | 114 | 114 | ||
425 | @@ -127,7 +127,7 @@ class UsingDistributionCredentials(Exception): | |||
426 | 127 | """The OCI Recipe is in a Distribution that has credentials set.""" | 127 | """The OCI Recipe is in a Distribution that has credentials set.""" |
427 | 128 | 128 | ||
428 | 129 | def __init__(self): | 129 | def __init__(self): |
430 | 130 | super(UsingDistributionCredentials, self).__init__( | 130 | super().__init__( |
431 | 131 | "The OCI recipe is in a distribution that has credentials set.") | 131 | "The OCI recipe is in a distribution that has credentials set.") |
432 | 132 | 132 | ||
433 | 133 | 133 | ||
434 | @@ -136,7 +136,7 @@ class NoSourceForOCIRecipe(Exception): | |||
435 | 136 | """OCI Recipes must have a source and build file.""" | 136 | """OCI Recipes must have a source and build file.""" |
436 | 137 | 137 | ||
437 | 138 | def __init__(self): | 138 | def __init__(self): |
439 | 139 | super(NoSourceForOCIRecipe, self).__init__( | 139 | super().__init__( |
440 | 140 | "New OCI recipes must have a git branch and build file.") | 140 | "New OCI recipes must have a git branch and build file.") |
441 | 141 | 141 | ||
442 | 142 | 142 | ||
443 | @@ -149,8 +149,7 @@ class CannotModifyOCIRecipeProcessor(Exception): | |||
444 | 149 | 'by administrators.') | 149 | 'by administrators.') |
445 | 150 | 150 | ||
446 | 151 | def __init__(self, processor): | 151 | def __init__(self, processor): |
449 | 152 | super(CannotModifyOCIRecipeProcessor, self).__init__( | 152 | super().__init__(self._fmt % {'processor': processor.name}) |
448 | 153 | self._fmt % {'processor': processor.name}) | ||
450 | 154 | 153 | ||
451 | 155 | 154 | ||
452 | 156 | @error_status(http.client.BAD_REQUEST) | 155 | @error_status(http.client.BAD_REQUEST) |
453 | @@ -158,7 +157,7 @@ class OCIRecipePrivacyMismatch(Exception): | |||
454 | 158 | """OCI recipe privacy does not match its content.""" | 157 | """OCI recipe privacy does not match its content.""" |
455 | 159 | 158 | ||
456 | 160 | def __init__(self, message=None): | 159 | def __init__(self, message=None): |
458 | 161 | super(OCIRecipePrivacyMismatch, self).__init__( | 160 | super().__init__( |
459 | 162 | message or | 161 | message or |
460 | 163 | "OCI recipe contains private information and cannot be public.") | 162 | "OCI recipe contains private information and cannot be public.") |
461 | 164 | 163 | ||
462 | @@ -168,7 +167,7 @@ class OCIRecipeBranchHasInvalidFormat(Exception): | |||
463 | 168 | """The branch name for the OCI recipe does not match the correct format.""" | 167 | """The branch name for the OCI recipe does not match the correct format.""" |
464 | 169 | 168 | ||
465 | 170 | def __init__(self): | 169 | def __init__(self): |
467 | 171 | super(OCIRecipeBranchHasInvalidFormat, self).__init__( | 170 | super().__init__( |
468 | 172 | "The branch name for the OCI recipe does not " | 171 | "The branch name for the OCI recipe does not " |
469 | 173 | "match the APPVERSION-UBUNTUVERSION format (ex. v1.0-20.04)") | 172 | "match the APPVERSION-UBUNTUVERSION format (ex. v1.0-20.04)") |
470 | 174 | 173 | ||
471 | diff --git a/lib/lp/oci/interfaces/ociregistryclient.py b/lib/lp/oci/interfaces/ociregistryclient.py | |||
472 | index 323137d..e149a28 100644 | |||
473 | --- a/lib/lp/oci/interfaces/ociregistryclient.py | |||
474 | +++ b/lib/lp/oci/interfaces/ociregistryclient.py | |||
475 | @@ -18,7 +18,7 @@ class OCIRegistryError(Exception): | |||
476 | 18 | """An error returned by an OCI registry.""" | 18 | """An error returned by an OCI registry.""" |
477 | 19 | 19 | ||
478 | 20 | def __init__(self, summary, errors): | 20 | def __init__(self, summary, errors): |
480 | 21 | super(OCIRegistryError, self).__init__(summary) | 21 | super().__init__(summary) |
481 | 22 | self.errors = errors | 22 | self.errors = errors |
482 | 23 | 23 | ||
483 | 24 | 24 | ||
484 | diff --git a/lib/lp/oci/interfaces/ociregistrycredentials.py b/lib/lp/oci/interfaces/ociregistrycredentials.py | |||
485 | index 16af53e..a10400c 100644 | |||
486 | --- a/lib/lp/oci/interfaces/ociregistrycredentials.py | |||
487 | +++ b/lib/lp/oci/interfaces/ociregistrycredentials.py | |||
488 | @@ -39,7 +39,7 @@ class OCIRegistryCredentialsAlreadyExist(Exception): | |||
489 | 39 | """ | 39 | """ |
490 | 40 | 40 | ||
491 | 41 | def __init__(self): | 41 | def __init__(self): |
493 | 42 | super(OCIRegistryCredentialsAlreadyExist, self).__init__( | 42 | super().__init__( |
494 | 43 | "Credentials already exist with the same URL, username, and " | 43 | "Credentials already exist with the same URL, username, and " |
495 | 44 | "region.") | 44 | "region.") |
496 | 45 | 45 | ||
497 | diff --git a/lib/lp/oci/model/ocirecipe.py b/lib/lp/oci/model/ocirecipe.py | |||
498 | index 274092d..73edd1a 100644 | |||
499 | --- a/lib/lp/oci/model/ocirecipe.py | |||
500 | +++ b/lib/lp/oci/model/ocirecipe.py | |||
501 | @@ -16,7 +16,6 @@ __all__ = [ | |||
502 | 16 | 16 | ||
503 | 17 | from lazr.lifecycle.event import ObjectCreatedEvent | 17 | from lazr.lifecycle.event import ObjectCreatedEvent |
504 | 18 | import pytz | 18 | import pytz |
505 | 19 | import six | ||
506 | 20 | from storm.databases.postgres import JSON | 19 | from storm.databases.postgres import JSON |
507 | 21 | from storm.expr import ( | 20 | from storm.expr import ( |
508 | 22 | And, | 21 | And, |
509 | @@ -246,7 +245,7 @@ class OCIRecipe(Storm, WebhookTargetMixin): | |||
510 | 246 | image_name=None, information_type=InformationType.PUBLIC): | 245 | image_name=None, information_type=InformationType.PUBLIC): |
511 | 247 | if not getFeatureFlag(OCI_RECIPE_ALLOW_CREATE): | 246 | if not getFeatureFlag(OCI_RECIPE_ALLOW_CREATE): |
512 | 248 | raise OCIRecipeFeatureDisabled() | 247 | raise OCIRecipeFeatureDisabled() |
514 | 249 | super(OCIRecipe, self).__init__() | 248 | super().__init__() |
515 | 250 | self._information_type = information_type | 249 | self._information_type = information_type |
516 | 251 | self.oci_project = oci_project | 250 | self.oci_project = oci_project |
517 | 252 | self.name = name | 251 | self.name = name |
518 | @@ -311,8 +310,7 @@ class OCIRecipe(Storm, WebhookTargetMixin): | |||
519 | 311 | @build_args.setter | 310 | @build_args.setter |
520 | 312 | def build_args(self, value): | 311 | def build_args(self, value): |
521 | 313 | assert value is None or isinstance(value, dict) | 312 | assert value is None or isinstance(value, dict) |
524 | 314 | self._build_args = {k: six.text_type(v) | 313 | self._build_args = {k: str(v) for k, v in (value or {}).items()} |
523 | 315 | for k, v in (value or {}).items()} | ||
525 | 316 | 314 | ||
526 | 317 | def _reconcileAccess(self): | 315 | def _reconcileAccess(self): |
527 | 318 | """Reconcile the OCI recipe's sharing information. | 316 | """Reconcile the OCI recipe's sharing information. |
528 | diff --git a/lib/lp/oci/model/ocirecipebuild.py b/lib/lp/oci/model/ocirecipebuild.py | |||
529 | index 0172697..fc4e3e2 100644 | |||
530 | --- a/lib/lp/oci/model/ocirecipebuild.py | |||
531 | +++ b/lib/lp/oci/model/ocirecipebuild.py | |||
532 | @@ -104,7 +104,7 @@ class OCIFile(StormBase): | |||
533 | 104 | 104 | ||
534 | 105 | def __init__(self, build, library_file, layer_file_digest=None): | 105 | def __init__(self, build, library_file, layer_file_digest=None): |
535 | 106 | """Construct a `OCIFile`.""" | 106 | """Construct a `OCIFile`.""" |
537 | 107 | super(OCIFile, self).__init__() | 107 | super().__init__() |
538 | 108 | self.build = build | 108 | self.build = build |
539 | 109 | self.library_file = library_file | 109 | self.library_file = library_file |
540 | 110 | self.layer_file_digest = layer_file_digest | 110 | self.layer_file_digest = layer_file_digest |
541 | @@ -409,7 +409,7 @@ class OCIRecipeBuild(PackageBuildMixin, StormBase): | |||
542 | 409 | """See `IBuildFarmJob`.""" | 409 | """See `IBuildFarmJob`.""" |
543 | 410 | edited_fields = set() | 410 | edited_fields = set() |
544 | 411 | with notify_modified(self, edited_fields) as previous_obj: | 411 | with notify_modified(self, edited_fields) as previous_obj: |
546 | 412 | super(OCIRecipeBuild, self).updateStatus( | 412 | super().updateStatus( |
547 | 413 | status, builder=builder, slave_status=slave_status, | 413 | status, builder=builder, slave_status=slave_status, |
548 | 414 | date_started=date_started, date_finished=date_finished, | 414 | date_started=date_started, date_finished=date_finished, |
549 | 415 | force_invalid_transition=force_invalid_transition) | 415 | force_invalid_transition=force_invalid_transition) |
550 | diff --git a/lib/lp/oci/model/ocirecipebuildbehaviour.py b/lib/lp/oci/model/ocirecipebuildbehaviour.py | |||
551 | index 46c8569..0532204 100644 | |||
552 | --- a/lib/lp/oci/model/ocirecipebuildbehaviour.py | |||
553 | +++ b/lib/lp/oci/model/ocirecipebuildbehaviour.py | |||
554 | @@ -126,8 +126,7 @@ class OCIRecipeBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): | |||
555 | 126 | Return the extra arguments required by the slave for the given build. | 126 | Return the extra arguments required by the slave for the given build. |
556 | 127 | """ | 127 | """ |
557 | 128 | build = self.build | 128 | build = self.build |
560 | 129 | args = yield super(OCIRecipeBuildBehaviour, self).extraBuildArgs( | 129 | args = yield super().extraBuildArgs(logger=logger) |
559 | 130 | logger=logger) | ||
561 | 131 | yield self.addProxyArgs(args, build.recipe.allow_internet) | 130 | yield self.addProxyArgs(args, build.recipe.allow_internet) |
562 | 132 | # XXX twom 2020-02-17 This may need to be more complex, and involve | 131 | # XXX twom 2020-02-17 This may need to be more complex, and involve |
563 | 133 | # distribution name. | 132 | # distribution name. |
564 | @@ -186,7 +185,7 @@ class OCIRecipeBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): | |||
565 | 186 | self._ensureFilePath(name, file_path, upload_path) | 185 | self._ensureFilePath(name, file_path, upload_path) |
566 | 187 | yield self._slave.getFile(file_hash, file_path) | 186 | yield self._slave.getFile(file_hash, file_path) |
567 | 188 | 187 | ||
569 | 189 | with open(file_path, 'r') as file_fp: | 188 | with open(file_path) as file_fp: |
570 | 190 | return json.load(file_fp) | 189 | return json.load(file_fp) |
571 | 191 | 190 | ||
572 | 192 | def _extractLayerFiles(self, upload_path, section, config, digests, files): | 191 | def _extractLayerFiles(self, upload_path, section, config, digests, files): |
573 | diff --git a/lib/lp/oci/model/ocirecipebuildjob.py b/lib/lp/oci/model/ocirecipebuildjob.py | |||
574 | index 1d3143b..4d7f098 100644 | |||
575 | --- a/lib/lp/oci/model/ocirecipebuildjob.py | |||
576 | +++ b/lib/lp/oci/model/ocirecipebuildjob.py | |||
577 | @@ -95,7 +95,7 @@ class OCIRecipeBuildJob(StormBase): | |||
578 | 95 | :param json_data: The type-specific variables, as a JSON-compatible | 95 | :param json_data: The type-specific variables, as a JSON-compatible |
579 | 96 | dict. | 96 | dict. |
580 | 97 | """ | 97 | """ |
582 | 98 | super(OCIRecipeBuildJob, self).__init__() | 98 | super().__init__() |
583 | 99 | self.job = Job(**job_args) | 99 | self.job = Job(**job_args) |
584 | 100 | self.build = build | 100 | self.build = build |
585 | 101 | self.job_type = job_type | 101 | self.job_type = job_type |
586 | @@ -156,7 +156,7 @@ class OCIRecipeBuildJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass): | |||
587 | 156 | 156 | ||
588 | 157 | def getOopsVars(self): | 157 | def getOopsVars(self): |
589 | 158 | """See `IRunnableJob`.""" | 158 | """See `IRunnableJob`.""" |
591 | 159 | oops_vars = super(OCIRecipeBuildJobDerived, self).getOopsVars() | 159 | oops_vars = super().getOopsVars() |
592 | 160 | oops_vars.extend([ | 160 | oops_vars.extend([ |
593 | 161 | ('job_type', self.context.job_type.title), | 161 | ('job_type', self.context.job_type.title), |
594 | 162 | ('build_id', self.context.build.id), | 162 | ('build_id', self.context.build.id), |
595 | @@ -232,7 +232,7 @@ class OCIRegistryUploadJob(OCIRecipeBuildJobDerived): | |||
596 | 232 | *args, **kwargs): | 232 | *args, **kwargs): |
597 | 233 | edited_fields = set() | 233 | edited_fields = set() |
598 | 234 | with notify_modified(self.build, edited_fields) as before_modification: | 234 | with notify_modified(self.build, edited_fields) as before_modification: |
600 | 235 | getattr(super(OCIRegistryUploadJob, self), method_name)( | 235 | getattr(super(), method_name)( |
601 | 236 | *args, manage_transaction=manage_transaction, **kwargs) | 236 | *args, manage_transaction=manage_transaction, **kwargs) |
602 | 237 | upload_status = self.build.registry_upload_status | 237 | upload_status = self.build.registry_upload_status |
603 | 238 | if upload_status != before_modification.registry_upload_status: | 238 | if upload_status != before_modification.registry_upload_status: |
604 | diff --git a/lib/lp/oci/model/ocirecipejob.py b/lib/lp/oci/model/ocirecipejob.py | |||
605 | index 33f3429..4ba7d5e 100644 | |||
606 | --- a/lib/lp/oci/model/ocirecipejob.py | |||
607 | +++ b/lib/lp/oci/model/ocirecipejob.py | |||
608 | @@ -96,7 +96,7 @@ class OCIRecipeJob(StormBase): | |||
609 | 96 | :param metadata: The type-specific variables, as a JSON-compatible | 96 | :param metadata: The type-specific variables, as a JSON-compatible |
610 | 97 | dict. | 97 | dict. |
611 | 98 | """ | 98 | """ |
613 | 99 | super(OCIRecipeJob, self).__init__() | 99 | super().__init__() |
614 | 100 | self.job = Job(**job_args) | 100 | self.job = Job(**job_args) |
615 | 101 | self.recipe = recipe | 101 | self.recipe = recipe |
616 | 102 | self.job_type = job_type | 102 | self.job_type = job_type |
617 | @@ -145,7 +145,7 @@ class OCIRecipeJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass): | |||
618 | 145 | 145 | ||
619 | 146 | def getOopsVars(self): | 146 | def getOopsVars(self): |
620 | 147 | """See `IRunnableJob`.""" | 147 | """See `IRunnableJob`.""" |
622 | 148 | oops_vars = super(OCIRecipeJobDerived, self).getOopsVars() | 148 | oops_vars = super().getOopsVars() |
623 | 149 | oops_vars.extend([ | 149 | oops_vars.extend([ |
624 | 150 | ("job_id", self.context.job.id), | 150 | ("job_id", self.context.job.id), |
625 | 151 | ("job_type", self.context.job_type.title), | 151 | ("job_type", self.context.job_type.title), |
626 | diff --git a/lib/lp/oci/model/ocirecipesubscription.py b/lib/lp/oci/model/ocirecipesubscription.py | |||
627 | index 970c66c..4de765e 100644 | |||
628 | --- a/lib/lp/oci/model/ocirecipesubscription.py | |||
629 | +++ b/lib/lp/oci/model/ocirecipesubscription.py | |||
630 | @@ -44,7 +44,7 @@ class OCIRecipeSubscription(StormBase): | |||
631 | 44 | subscribed_by = Reference(subscribed_by_id, "Person.id") | 44 | subscribed_by = Reference(subscribed_by_id, "Person.id") |
632 | 45 | 45 | ||
633 | 46 | def __init__(self, recipe, person, subscribed_by): | 46 | def __init__(self, recipe, person, subscribed_by): |
635 | 47 | super(OCIRecipeSubscription, self).__init__() | 47 | super().__init__() |
636 | 48 | self.recipe = recipe | 48 | self.recipe = recipe |
637 | 49 | self.person = person | 49 | self.person = person |
638 | 50 | self.subscribed_by = subscribed_by | 50 | self.subscribed_by = subscribed_by |
639 | diff --git a/lib/lp/oci/model/ociregistryclient.py b/lib/lp/oci/model/ociregistryclient.py | |||
640 | index 198a4b2..30a99ad 100644 | |||
641 | --- a/lib/lp/oci/model/ociregistryclient.py | |||
642 | +++ b/lib/lp/oci/model/ociregistryclient.py | |||
643 | @@ -617,7 +617,7 @@ class OCIRegistryClient: | |||
644 | 617 | 617 | ||
645 | 618 | class OCIRegistryAuthenticationError(Exception): | 618 | class OCIRegistryAuthenticationError(Exception): |
646 | 619 | def __init__(self, msg, http_error=None): | 619 | def __init__(self, msg, http_error=None): |
648 | 620 | super(OCIRegistryAuthenticationError, self).__init__(msg) | 620 | super().__init__(msg) |
649 | 621 | self.http_error = http_error | 621 | self.http_error = http_error |
650 | 622 | 622 | ||
651 | 623 | 623 | ||
652 | @@ -696,7 +696,7 @@ class BearerTokenRegistryClient(RegistryHTTPClient): | |||
653 | 696 | """ | 696 | """ |
654 | 697 | 697 | ||
655 | 698 | def __init__(self, push_rule): | 698 | def __init__(self, push_rule): |
657 | 699 | super(BearerTokenRegistryClient, self).__init__(push_rule) | 699 | super().__init__(push_rule) |
658 | 700 | self.auth_token = None | 700 | self.auth_token = None |
659 | 701 | 701 | ||
660 | 702 | def parseAuthInstructions(self, request): | 702 | def parseAuthInstructions(self, request): |
661 | @@ -721,7 +721,7 @@ class BearerTokenRegistryClient(RegistryHTTPClient): | |||
662 | 721 | "Auth instructions didn't include realm to get the token: %s" | 721 | "Auth instructions didn't include realm to get the token: %s" |
663 | 722 | % values) | 722 | % values) |
664 | 723 | # We should use the basic auth version for this request. | 723 | # We should use the basic auth version for this request. |
666 | 724 | response = super(BearerTokenRegistryClient, self).request( | 724 | response = super().request( |
667 | 725 | url, params=values, method="GET", auth=self.credentials) | 725 | url, params=values, method="GET", auth=self.credentials) |
668 | 726 | response.raise_for_status() | 726 | response.raise_for_status() |
669 | 727 | response_data = response.json() | 727 | response_data = response.json() |
670 | diff --git a/lib/lp/oci/tests/helpers.py b/lib/lp/oci/tests/helpers.py | |||
671 | index c3b7b4b..336b078 100644 | |||
672 | --- a/lib/lp/oci/tests/helpers.py | |||
673 | +++ b/lib/lp/oci/tests/helpers.py | |||
674 | @@ -49,7 +49,7 @@ class MatchesOCIRegistryCredentials(MatchesAll): | |||
675 | 49 | """ | 49 | """ |
676 | 50 | 50 | ||
677 | 51 | def __init__(self, main_matcher, credentials_matcher): | 51 | def __init__(self, main_matcher, credentials_matcher): |
679 | 52 | super(MatchesOCIRegistryCredentials, self).__init__( | 52 | super().__init__( |
680 | 53 | main_matcher, | 53 | main_matcher, |
681 | 54 | AfterPreprocessing( | 54 | AfterPreprocessing( |
682 | 55 | lambda matchee: removeSecurityProxy(matchee).getCredentials(), | 55 | lambda matchee: removeSecurityProxy(matchee).getCredentials(), |
683 | diff --git a/lib/lp/oci/tests/test_ocipushrule.py b/lib/lp/oci/tests/test_ocipushrule.py | |||
684 | index 52fee49..043c6b9 100644 | |||
685 | --- a/lib/lp/oci/tests/test_ocipushrule.py | |||
686 | +++ b/lib/lp/oci/tests/test_ocipushrule.py | |||
687 | @@ -27,7 +27,7 @@ class TestOCIPushRule(OCIConfigHelperMixin, TestCaseWithFactory): | |||
688 | 27 | layer = LaunchpadZopelessLayer | 27 | layer = LaunchpadZopelessLayer |
689 | 28 | 28 | ||
690 | 29 | def setUp(self): | 29 | def setUp(self): |
692 | 30 | super(TestOCIPushRule, self).setUp() | 30 | super().setUp() |
693 | 31 | self.setConfig() | 31 | self.setConfig() |
694 | 32 | 32 | ||
695 | 33 | def test_implements_interface(self): | 33 | def test_implements_interface(self): |
696 | @@ -75,7 +75,7 @@ class TestOCIPushRuleSet(OCIConfigHelperMixin, TestCaseWithFactory): | |||
697 | 75 | layer = LaunchpadZopelessLayer | 75 | layer = LaunchpadZopelessLayer |
698 | 76 | 76 | ||
699 | 77 | def setUp(self): | 77 | def setUp(self): |
701 | 78 | super(TestOCIPushRuleSet, self).setUp() | 78 | super().setUp() |
702 | 79 | self.setConfig() | 79 | self.setConfig() |
703 | 80 | 80 | ||
704 | 81 | def test_implements_interface(self): | 81 | def test_implements_interface(self): |
705 | diff --git a/lib/lp/oci/tests/test_ocirecipe.py b/lib/lp/oci/tests/test_ocirecipe.py | |||
706 | index 6bab89e..b3b4475 100644 | |||
707 | --- a/lib/lp/oci/tests/test_ocirecipe.py | |||
708 | +++ b/lib/lp/oci/tests/test_ocirecipe.py | |||
709 | @@ -7,8 +7,6 @@ from datetime import datetime | |||
710 | 7 | import json | 7 | import json |
711 | 8 | 8 | ||
712 | 9 | from fixtures import FakeLogger | 9 | from fixtures import FakeLogger |
713 | 10 | import six | ||
714 | 11 | from six import string_types | ||
715 | 12 | from storm.exceptions import LostObjectError | 10 | from storm.exceptions import LostObjectError |
716 | 13 | from storm.store import Store | 11 | from storm.store import Store |
717 | 14 | from testtools import ExpectedException | 12 | from testtools import ExpectedException |
718 | @@ -113,7 +111,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): | |||
719 | 113 | layer = DatabaseFunctionalLayer | 111 | layer = DatabaseFunctionalLayer |
720 | 114 | 112 | ||
721 | 115 | def setUp(self): | 113 | def setUp(self): |
723 | 116 | super(TestOCIRecipe, self).setUp() | 114 | super().setUp() |
724 | 117 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 115 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
725 | 118 | 116 | ||
726 | 119 | def test_implements_interface(self): | 117 | def test_implements_interface(self): |
727 | @@ -759,7 +757,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): | |||
728 | 759 | # It should be sorted by owner's name first, then recipe name. | 757 | # It should be sorted by owner's name first, then recipe name. |
729 | 760 | self.assertEqual( | 758 | self.assertEqual( |
730 | 761 | [recipe3, recipe1, recipe2], | 759 | [recipe3, recipe1, recipe2], |
732 | 762 | list(oci_project.searchRecipes(u"a"))) | 760 | list(oci_project.searchRecipes("a"))) |
733 | 763 | 761 | ||
734 | 764 | def test_build_args_dict(self): | 762 | def test_build_args_dict(self): |
735 | 765 | args = {"MY_VERSION": "1.0.3", "ANOTHER_VERSION": "2.9.88"} | 763 | args = {"MY_VERSION": "1.0.3", "ANOTHER_VERSION": "2.9.88"} |
736 | @@ -784,7 +782,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): | |||
737 | 784 | # Makes sure we only store one level of key=pair, flattening to | 782 | # Makes sure we only store one level of key=pair, flattening to |
738 | 785 | # string every value. | 783 | # string every value. |
739 | 786 | args = { | 784 | args = { |
741 | 787 | "VAR1": {six.ensure_str("something"): [1, 2, 3]}, | 785 | "VAR1": {"something": [1, 2, 3]}, |
742 | 788 | "VAR2": 123, | 786 | "VAR2": 123, |
743 | 789 | "VAR3": "A string", | 787 | "VAR3": "A string", |
744 | 790 | } | 788 | } |
745 | @@ -873,7 +871,7 @@ class TestOCIRecipeAccessControl(TestCaseWithFactory, OCIConfigHelperMixin): | |||
746 | 873 | layer = DatabaseFunctionalLayer | 871 | layer = DatabaseFunctionalLayer |
747 | 874 | 872 | ||
748 | 875 | def setUp(self): | 873 | def setUp(self): |
750 | 876 | super(TestOCIRecipeAccessControl, self).setUp() | 874 | super().setUp() |
751 | 877 | self.setConfig() | 875 | self.setConfig() |
752 | 878 | 876 | ||
753 | 879 | def test_change_oci_project_pillar_reconciles_access(self): | 877 | def test_change_oci_project_pillar_reconciles_access(self): |
754 | @@ -1042,8 +1040,7 @@ class TestOCIRecipeProcessors(TestCaseWithFactory): | |||
755 | 1042 | layer = DatabaseFunctionalLayer | 1040 | layer = DatabaseFunctionalLayer |
756 | 1043 | 1041 | ||
757 | 1044 | def setUp(self): | 1042 | def setUp(self): |
760 | 1045 | super(TestOCIRecipeProcessors, self).setUp( | 1043 | super().setUp(user="foo.bar@canonical.com") |
759 | 1046 | user="foo.bar@canonical.com") | ||
761 | 1047 | self.default_procs = [ | 1044 | self.default_procs = [ |
762 | 1048 | getUtility(IProcessorSet).getByName("386"), | 1045 | getUtility(IProcessorSet).getByName("386"), |
763 | 1049 | getUtility(IProcessorSet).getByName("amd64")] | 1046 | getUtility(IProcessorSet).getByName("amd64")] |
764 | @@ -1192,7 +1189,7 @@ class TestOCIRecipeSet(TestCaseWithFactory): | |||
765 | 1192 | layer = DatabaseFunctionalLayer | 1189 | layer = DatabaseFunctionalLayer |
766 | 1193 | 1190 | ||
767 | 1194 | def setUp(self): | 1191 | def setUp(self): |
769 | 1195 | super(TestOCIRecipeSet, self).setUp() | 1192 | super().setUp() |
770 | 1196 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 1193 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
771 | 1197 | 1194 | ||
772 | 1198 | def test_implements_interface(self): | 1195 | def test_implements_interface(self): |
773 | @@ -1373,7 +1370,7 @@ class TestOCIRecipeWebservice(OCIConfigHelperMixin, TestCaseWithFactory): | |||
774 | 1373 | layer = DatabaseFunctionalLayer | 1370 | layer = DatabaseFunctionalLayer |
775 | 1374 | 1371 | ||
776 | 1375 | def setUp(self): | 1372 | def setUp(self): |
778 | 1376 | super(TestOCIRecipeWebservice, self).setUp() | 1373 | super().setUp() |
779 | 1377 | self.person = self.factory.makePerson( | 1374 | self.person = self.factory.makePerson( |
780 | 1378 | displayname="Test Person") | 1375 | displayname="Test Person") |
781 | 1379 | self.webservice = webservice_for_person( | 1376 | self.webservice = webservice_for_person( |
782 | @@ -1384,7 +1381,7 @@ class TestOCIRecipeWebservice(OCIConfigHelperMixin, TestCaseWithFactory): | |||
783 | 1384 | def getAbsoluteURL(self, target): | 1381 | def getAbsoluteURL(self, target): |
784 | 1385 | """Get the webservice absolute URL of the given object or relative | 1382 | """Get the webservice absolute URL of the given object or relative |
785 | 1386 | path.""" | 1383 | path.""" |
787 | 1387 | if not isinstance(target, string_types): | 1384 | if not isinstance(target, str): |
788 | 1388 | target = api_url(target) | 1385 | target = api_url(target) |
789 | 1389 | return self.webservice.getAbsoluteUrl(target) | 1386 | return self.webservice.getAbsoluteUrl(target) |
790 | 1390 | 1387 | ||
791 | @@ -1688,7 +1685,7 @@ class TestOCIRecipeAsyncWebservice(TestCaseWithFactory): | |||
792 | 1688 | layer = LaunchpadFunctionalLayer | 1685 | layer = LaunchpadFunctionalLayer |
793 | 1689 | 1686 | ||
794 | 1690 | def setUp(self): | 1687 | def setUp(self): |
796 | 1691 | super(TestOCIRecipeAsyncWebservice, self).setUp() | 1688 | super().setUp() |
797 | 1692 | self.person = self.factory.makePerson( | 1689 | self.person = self.factory.makePerson( |
798 | 1693 | displayname="Test Person") | 1690 | displayname="Test Person") |
799 | 1694 | self.webservice = webservice_for_person( | 1691 | self.webservice = webservice_for_person( |
800 | @@ -1764,8 +1761,8 @@ class TestOCIRecipeAsyncWebservice(TestCaseWithFactory): | |||
801 | 1764 | "recipe_link": Equals(abs_url(oci_recipe)), | 1761 | "recipe_link": Equals(abs_url(oci_recipe)), |
802 | 1765 | "requester_link": Equals(abs_url(self.person)), | 1762 | "requester_link": Equals(abs_url(self.person)), |
803 | 1766 | "buildstate": Equals("Needs building"), | 1763 | "buildstate": Equals("Needs building"), |
806 | 1767 | "eta": IsInstance(string_types, type(None)), | 1764 | "eta": IsInstance(str, type(None)), |
807 | 1768 | "date": IsInstance(string_types, type(None)), | 1765 | "date": IsInstance(str, type(None)), |
808 | 1769 | "estimate": IsInstance(bool), | 1766 | "estimate": IsInstance(bool), |
809 | 1770 | "distro_arch_series_link": Equals(abs_url(arch_series)), | 1767 | "distro_arch_series_link": Equals(abs_url(arch_series)), |
810 | 1771 | "registry_upload_status": Equals("Unscheduled"), | 1768 | "registry_upload_status": Equals("Unscheduled"), |
811 | diff --git a/lib/lp/oci/tests/test_ocirecipebuild.py b/lib/lp/oci/tests/test_ocirecipebuild.py | |||
812 | index c86169e..1ec8718 100644 | |||
813 | --- a/lib/lp/oci/tests/test_ocirecipebuild.py | |||
814 | +++ b/lib/lp/oci/tests/test_ocirecipebuild.py | |||
815 | @@ -11,7 +11,6 @@ from datetime import ( | |||
816 | 11 | from fixtures import FakeLogger | 11 | from fixtures import FakeLogger |
817 | 12 | from pymacaroons import Macaroon | 12 | from pymacaroons import Macaroon |
818 | 13 | import pytz | 13 | import pytz |
819 | 14 | import six | ||
820 | 15 | from six.moves.urllib.request import urlopen | 14 | from six.moves.urllib.request import urlopen |
821 | 16 | from testtools.matchers import ( | 15 | from testtools.matchers import ( |
822 | 17 | ContainsDict, | 16 | ContainsDict, |
823 | @@ -93,7 +92,7 @@ class TestOCIFileSet(TestCaseWithFactory): | |||
824 | 93 | layer = LaunchpadZopelessLayer | 92 | layer = LaunchpadZopelessLayer |
825 | 94 | 93 | ||
826 | 95 | def setUp(self): | 94 | def setUp(self): |
828 | 96 | super(TestOCIFileSet, self).setUp() | 95 | super().setUp() |
829 | 97 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 96 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
830 | 98 | 97 | ||
831 | 99 | def test_implements_interface(self): | 98 | def test_implements_interface(self): |
832 | @@ -119,7 +118,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): | |||
833 | 119 | layer = LaunchpadZopelessLayer | 118 | layer = LaunchpadZopelessLayer |
834 | 120 | 119 | ||
835 | 121 | def setUp(self): | 120 | def setUp(self): |
837 | 122 | super(TestOCIRecipeBuild, self).setUp() | 121 | super().setUp() |
838 | 123 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 122 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
839 | 124 | self.build = self.factory.makeOCIRecipeBuild() | 123 | self.build = self.factory.makeOCIRecipeBuild() |
840 | 125 | 124 | ||
841 | @@ -160,7 +159,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): | |||
842 | 160 | 159 | ||
843 | 161 | def test_getLayerFileByDigest(self): | 160 | def test_getLayerFileByDigest(self): |
844 | 162 | files = [self.factory.makeOCIFile( | 161 | files = [self.factory.makeOCIFile( |
846 | 163 | build=self.build, layer_file_digest=six.text_type(x)) | 162 | build=self.build, layer_file_digest=str(x)) |
847 | 164 | for x in range(3)] | 163 | for x in range(3)] |
848 | 165 | result, _, _ = self.build.getLayerFileByDigest( | 164 | result, _, _ = self.build.getLayerFileByDigest( |
849 | 166 | files[0].layer_file_digest) | 165 | files[0].layer_file_digest) |
850 | @@ -168,7 +167,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): | |||
851 | 168 | 167 | ||
852 | 169 | def test_getLayerFileByDigest_missing(self): | 168 | def test_getLayerFileByDigest_missing(self): |
853 | 170 | [self.factory.makeOCIFile( | 169 | [self.factory.makeOCIFile( |
855 | 171 | build=self.build, layer_file_digest=six.text_type(x)) | 170 | build=self.build, layer_file_digest=str(x)) |
856 | 172 | for x in range(3)] | 171 | for x in range(3)] |
857 | 173 | self.assertRaises( | 172 | self.assertRaises( |
858 | 174 | NotFoundError, | 173 | NotFoundError, |
859 | @@ -609,7 +608,7 @@ class TestOCIRecipeBuildSet(TestCaseWithFactory): | |||
860 | 609 | layer = DatabaseFunctionalLayer | 608 | layer = DatabaseFunctionalLayer |
861 | 610 | 609 | ||
862 | 611 | def setUp(self): | 610 | def setUp(self): |
864 | 612 | super(TestOCIRecipeBuildSet, self).setUp() | 611 | super().setUp() |
865 | 613 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 612 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
866 | 614 | 613 | ||
867 | 615 | def test_implements_interface(self): | 614 | def test_implements_interface(self): |
868 | @@ -707,7 +706,7 @@ class TestOCIRecipeBuildWebservice(OCIConfigHelperMixin, TestCaseWithFactory): | |||
869 | 707 | layer = LaunchpadFunctionalLayer | 706 | layer = LaunchpadFunctionalLayer |
870 | 708 | 707 | ||
871 | 709 | def setUp(self): | 708 | def setUp(self): |
873 | 710 | super(TestOCIRecipeBuildWebservice, self).setUp() | 709 | super().setUp() |
874 | 711 | self.setConfig() | 710 | self.setConfig() |
875 | 712 | self.person = self.factory.makePerson() | 711 | self.person = self.factory.makePerson() |
876 | 713 | self.webservice = webservice_for_person( | 712 | self.webservice = webservice_for_person( |
877 | @@ -855,7 +854,7 @@ class TestOCIRecipeBuildMacaroonIssuer( | |||
878 | 855 | layer = LaunchpadZopelessLayer | 854 | layer = LaunchpadZopelessLayer |
879 | 856 | 855 | ||
880 | 857 | def setUp(self): | 856 | def setUp(self): |
882 | 858 | super(TestOCIRecipeBuildMacaroonIssuer, self).setUp() | 857 | super().setUp() |
883 | 859 | self.setConfig() | 858 | self.setConfig() |
884 | 860 | self.pushConfig( | 859 | self.pushConfig( |
885 | 861 | "launchpad", internal_macaroon_secret_key="some-secret") | 860 | "launchpad", internal_macaroon_secret_key="some-secret") |
886 | diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py | |||
887 | index 5109dfe..0961a2b 100644 | |||
888 | --- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py | |||
889 | +++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py | |||
890 | @@ -140,7 +140,7 @@ class TestOCIBuildBehaviour(TestCaseWithFactory): | |||
891 | 140 | layer = LaunchpadZopelessLayer | 140 | layer = LaunchpadZopelessLayer |
892 | 141 | 141 | ||
893 | 142 | def setUp(self): | 142 | def setUp(self): |
895 | 143 | super(TestOCIBuildBehaviour, self).setUp() | 143 | super().setUp() |
896 | 144 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 144 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
897 | 145 | 145 | ||
898 | 146 | def test_provides_interface(self): | 146 | def test_provides_interface(self): |
899 | @@ -164,7 +164,7 @@ class TestAsyncOCIRecipeBuildBehaviour( | |||
900 | 164 | 164 | ||
901 | 165 | @defer.inlineCallbacks | 165 | @defer.inlineCallbacks |
902 | 166 | def setUp(self): | 166 | def setUp(self): |
904 | 167 | super(TestAsyncOCIRecipeBuildBehaviour, self).setUp() | 167 | super().setUp() |
905 | 168 | build_username = 'OCIBUILD-1' | 168 | build_username = 'OCIBUILD-1' |
906 | 169 | self.token = {'secret': uuid.uuid4().hex, | 169 | self.token = {'secret': uuid.uuid4().hex, |
907 | 170 | 'username': build_username, | 170 | 'username': build_username, |
908 | @@ -696,7 +696,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin, | |||
909 | 696 | self.slave.valid_files[hash] = path | 696 | self.slave.valid_files[hash] = path |
910 | 697 | 697 | ||
911 | 698 | def setUp(self): | 698 | def setUp(self): |
913 | 699 | super(TestHandleStatusForOCIRecipeBuild, self).setUp() | 699 | super().setUp() |
914 | 700 | self.useFixture(fixtures.FakeLogger()) | 700 | self.useFixture(fixtures.FakeLogger()) |
915 | 701 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 701 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
916 | 702 | self.build = self.makeBuild() | 702 | self.build = self.makeBuild() |
917 | @@ -766,7 +766,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin, | |||
918 | 766 | 'layer_2.tar.gz': 'layer_2_hash' | 766 | 'layer_2.tar.gz': 'layer_2_hash' |
919 | 767 | } | 767 | } |
920 | 768 | self.factory.makeOCIFile( | 768 | self.factory.makeOCIFile( |
922 | 769 | build=self.build, layer_file_digest=u'digest_1', | 769 | build=self.build, layer_file_digest='digest_1', |
923 | 770 | content=b"retrieved from librarian") | 770 | content=b"retrieved from librarian") |
924 | 771 | 771 | ||
925 | 772 | def assertResultCount(self, count, result): | 772 | def assertResultCount(self, count, result): |
926 | @@ -809,7 +809,7 @@ class TestHandleStatusForOCIRecipeBuild(MakeOCIBuildMixin, | |||
927 | 809 | def test_handleStatus_OK_reuse_from_other_build(self): | 809 | def test_handleStatus_OK_reuse_from_other_build(self): |
928 | 810 | """We should be able to reuse a layer file from a separate build.""" | 810 | """We should be able to reuse a layer file from a separate build.""" |
929 | 811 | oci_file = self.factory.makeOCIFile( | 811 | oci_file = self.factory.makeOCIFile( |
931 | 812 | layer_file_digest=u'digest_2', | 812 | layer_file_digest='digest_2', |
932 | 813 | content=b"layer 2 retrieved from librarian") | 813 | content=b"layer 2 retrieved from librarian") |
933 | 814 | 814 | ||
934 | 815 | now = datetime.now(pytz.UTC) | 815 | now = datetime.now(pytz.UTC) |
935 | @@ -971,4 +971,4 @@ class TestGetUploadMethodsForOCIRecipeBuild( | |||
936 | 971 | """IPackageBuild.getUpload-related methods work with OCI recipe builds.""" | 971 | """IPackageBuild.getUpload-related methods work with OCI recipe builds.""" |
937 | 972 | def setUp(self): | 972 | def setUp(self): |
938 | 973 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 973 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
940 | 974 | super(TestGetUploadMethodsForOCIRecipeBuild, self).setUp() | 974 | super().setUp() |
941 | diff --git a/lib/lp/oci/tests/test_ocirecipebuildjob.py b/lib/lp/oci/tests/test_ocirecipebuildjob.py | |||
942 | index 742b3ec..2bece4a 100644 | |||
943 | --- a/lib/lp/oci/tests/test_ocirecipebuildjob.py | |||
944 | +++ b/lib/lp/oci/tests/test_ocirecipebuildjob.py | |||
945 | @@ -99,7 +99,7 @@ class TestOCIRecipeBuildJob(TestCaseWithFactory): | |||
946 | 99 | layer = DatabaseFunctionalLayer | 99 | layer = DatabaseFunctionalLayer |
947 | 100 | 100 | ||
948 | 101 | def setUp(self): | 101 | def setUp(self): |
950 | 102 | super(TestOCIRecipeBuildJob, self).setUp() | 102 | super().setUp() |
951 | 103 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 103 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
952 | 104 | 104 | ||
953 | 105 | def test_provides_interface(self): | 105 | def test_provides_interface(self): |
954 | @@ -130,7 +130,7 @@ class TestOCIRecipeBuildJobDerived(TestCaseWithFactory): | |||
955 | 130 | layer = DatabaseFunctionalLayer | 130 | layer = DatabaseFunctionalLayer |
956 | 131 | 131 | ||
957 | 132 | def setUp(self): | 132 | def setUp(self): |
959 | 133 | super(TestOCIRecipeBuildJobDerived, self).setUp() | 133 | super().setUp() |
960 | 134 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 134 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
961 | 135 | 135 | ||
962 | 136 | def test_repr(self): | 136 | def test_repr(self): |
963 | @@ -151,8 +151,7 @@ class TestOCIRecipeBuildJobDerived(TestCaseWithFactory): | |||
964 | 151 | def __getattribute__(self, item): | 151 | def __getattribute__(self, item): |
965 | 152 | if item == 'build': | 152 | if item == 'build': |
966 | 153 | raise AttributeError("Somethng is wrong with build") | 153 | raise AttributeError("Somethng is wrong with build") |
969 | 154 | return super( | 154 | return super().__getattribute__(item) |
968 | 155 | ErrorOCIRecipeBuildJobDerived, self).__getattribute__(item) | ||
970 | 156 | oci_build = self.factory.makeOCIRecipeBuild() | 155 | oci_build = self.factory.makeOCIRecipeBuild() |
971 | 157 | job = OCIRecipeBuildJob( | 156 | job = OCIRecipeBuildJob( |
972 | 158 | oci_build, OCIRecipeBuildJobType.REGISTRY_UPLOAD, {}) | 157 | oci_build, OCIRecipeBuildJobType.REGISTRY_UPLOAD, {}) |
973 | @@ -204,7 +203,7 @@ class TestOCIRegistryUploadJob(TestCaseWithFactory, MultiArchRecipeMixin, | |||
974 | 204 | layer = LaunchpadZopelessLayer | 203 | layer = LaunchpadZopelessLayer |
975 | 205 | 204 | ||
976 | 206 | def setUp(self): | 205 | def setUp(self): |
978 | 207 | super(TestOCIRegistryUploadJob, self).setUp() | 206 | super().setUp() |
979 | 208 | self.useFixture(FeatureFixture({ | 207 | self.useFixture(FeatureFixture({ |
980 | 209 | 'webhooks.new.enabled': 'true', | 208 | 'webhooks.new.enabled': 'true', |
981 | 210 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: 'on', | 209 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: 'on', |
982 | @@ -556,7 +555,7 @@ class TestOCIRegistryUploadJobViaCelery(TestCaseWithFactory, | |||
983 | 556 | layer = CelerySlowJobLayer | 555 | layer = CelerySlowJobLayer |
984 | 557 | 556 | ||
985 | 558 | def setUp(self): | 557 | def setUp(self): |
987 | 559 | super(TestOCIRegistryUploadJobViaCelery, self).setUp() | 558 | super().setUp() |
988 | 560 | self.useFixture(FeatureFixture({ | 559 | self.useFixture(FeatureFixture({ |
989 | 561 | 'webhooks.new.enabled': 'true', | 560 | 'webhooks.new.enabled': 'true', |
990 | 562 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: 'on', | 561 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: 'on', |
991 | diff --git a/lib/lp/oci/tests/test_ocirecipejob.py b/lib/lp/oci/tests/test_ocirecipejob.py | |||
992 | index 2a37120..ef0400f 100644 | |||
993 | --- a/lib/lp/oci/tests/test_ocirecipejob.py | |||
994 | +++ b/lib/lp/oci/tests/test_ocirecipejob.py | |||
995 | @@ -29,7 +29,7 @@ class TestOCIRecipeRequestBuildsJob(TestCaseWithFactory): | |||
996 | 29 | layer = DatabaseFunctionalLayer | 29 | layer = DatabaseFunctionalLayer |
997 | 30 | 30 | ||
998 | 31 | def setUp(self): | 31 | def setUp(self): |
1000 | 32 | super(TestOCIRecipeRequestBuildsJob, self).setUp() | 32 | super().setUp() |
1001 | 33 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) | 33 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
1002 | 34 | 34 | ||
1003 | 35 | def getDistroArchSeries(self, distroseries, proc_name="386", | 35 | def getDistroArchSeries(self, distroseries, proc_name="386", |
1004 | diff --git a/lib/lp/oci/tests/test_ociregistryclient.py b/lib/lp/oci/tests/test_ociregistryclient.py | |||
1005 | index b6e84fc..22e8cfa 100644 | |||
1006 | --- a/lib/lp/oci/tests/test_ociregistryclient.py | |||
1007 | +++ b/lib/lp/oci/tests/test_ociregistryclient.py | |||
1008 | @@ -99,7 +99,7 @@ class TestOCIRegistryClient(OCIConfigHelperMixin, SpyProxyCallsMixin, | |||
1009 | 99 | retry_count = 0 | 99 | retry_count = 0 |
1010 | 100 | 100 | ||
1011 | 101 | def setUp(self): | 101 | def setUp(self): |
1013 | 102 | super(TestOCIRegistryClient, self).setUp() | 102 | super().setUp() |
1014 | 103 | self.setConfig() | 103 | self.setConfig() |
1015 | 104 | self.setupProxySpy() | 104 | self.setupProxySpy() |
1016 | 105 | self.manifest = [{ | 105 | self.manifest = [{ |
1017 | @@ -1174,7 +1174,7 @@ class TestRegistryHTTPClient(OCIConfigHelperMixin, SpyProxyCallsMixin, | |||
1018 | 1174 | layer = DatabaseFunctionalLayer | 1174 | layer = DatabaseFunctionalLayer |
1019 | 1175 | 1175 | ||
1020 | 1176 | def setUp(self): | 1176 | def setUp(self): |
1022 | 1177 | super(TestRegistryHTTPClient, self).setUp() | 1177 | super().setUp() |
1023 | 1178 | self.setConfig() | 1178 | self.setConfig() |
1024 | 1179 | self.setupProxySpy() | 1179 | self.setupProxySpy() |
1025 | 1180 | 1180 | ||
1026 | @@ -1314,8 +1314,8 @@ class TestRegistryHTTPClient(OCIConfigHelperMixin, SpyProxyCallsMixin, | |||
1027 | 1314 | boto.client.call_args) | 1314 | boto.client.call_args) |
1028 | 1315 | config = boto.client.call_args[-1]['config'] | 1315 | config = boto.client.call_args[-1]['config'] |
1029 | 1316 | self.assertEqual({ | 1316 | self.assertEqual({ |
1032 | 1317 | u'http': u'http://proxy.example.com:123', | 1317 | 'http': 'http://proxy.example.com:123', |
1033 | 1318 | u'https': u'http://proxy.example.com:123'}, config.proxies) | 1318 | 'https': 'http://proxy.example.com:123'}, config.proxies) |
1034 | 1319 | 1319 | ||
1035 | 1320 | @responses.activate | 1320 | @responses.activate |
1036 | 1321 | def test_aws_malformed_url_region(self): | 1321 | def test_aws_malformed_url_region(self): |
1037 | @@ -1336,7 +1336,7 @@ class TestBearerTokenRegistryClient(OCIConfigHelperMixin, | |||
1038 | 1336 | layer = DatabaseFunctionalLayer | 1336 | layer = DatabaseFunctionalLayer |
1039 | 1337 | 1337 | ||
1040 | 1338 | def setUp(self): | 1338 | def setUp(self): |
1042 | 1339 | super(TestBearerTokenRegistryClient, self).setUp() | 1339 | super().setUp() |
1043 | 1340 | self.setConfig() | 1340 | self.setConfig() |
1044 | 1341 | self.setupProxySpy() | 1341 | self.setupProxySpy() |
1045 | 1342 | 1342 | ||
1046 | @@ -1510,7 +1510,7 @@ class TestAWSAuthenticator(OCIConfigHelperMixin, TestCaseWithFactory): | |||
1047 | 1510 | layer = DatabaseFunctionalLayer | 1510 | layer = DatabaseFunctionalLayer |
1048 | 1511 | 1511 | ||
1049 | 1512 | def setUp(self): | 1512 | def setUp(self): |
1051 | 1513 | super(TestAWSAuthenticator, self).setUp() | 1513 | super().setUp() |
1052 | 1514 | self.setConfig() | 1514 | self.setConfig() |
1053 | 1515 | 1515 | ||
1054 | 1516 | def test_get_region_from_credential(self): | 1516 | def test_get_region_from_credential(self): |
1055 | diff --git a/lib/lp/oci/tests/test_ociregistrycredentials.py b/lib/lp/oci/tests/test_ociregistrycredentials.py | |||
1056 | index 1680091..66f51af 100644 | |||
1057 | --- a/lib/lp/oci/tests/test_ociregistrycredentials.py | |||
1058 | +++ b/lib/lp/oci/tests/test_ociregistrycredentials.py | |||
1059 | @@ -35,7 +35,7 @@ class TestOCIRegistryCredentials(OCIConfigHelperMixin, TestCaseWithFactory): | |||
1060 | 35 | layer = LaunchpadZopelessLayer | 35 | layer = LaunchpadZopelessLayer |
1061 | 36 | 36 | ||
1062 | 37 | def setUp(self): | 37 | def setUp(self): |
1064 | 38 | super(TestOCIRegistryCredentials, self).setUp() | 38 | super().setUp() |
1065 | 39 | self.setConfig() | 39 | self.setConfig() |
1066 | 40 | 40 | ||
1067 | 41 | def test_implements_interface(self): | 41 | def test_implements_interface(self): |
1068 | @@ -139,7 +139,7 @@ class TestOCIRegistryCredentialsSet(OCIConfigHelperMixin, TestCaseWithFactory): | |||
1069 | 139 | layer = LaunchpadZopelessLayer | 139 | layer = LaunchpadZopelessLayer |
1070 | 140 | 140 | ||
1071 | 141 | def setUp(self): | 141 | def setUp(self): |
1073 | 142 | super(TestOCIRegistryCredentialsSet, self).setUp() | 142 | super().setUp() |
1074 | 143 | self.setConfig() | 143 | self.setConfig() |
1075 | 144 | 144 | ||
1076 | 145 | def test_implements_interface(self): | 145 | def test_implements_interface(self): |
Self-approving (mechanical).