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

Proposed by Colin Watson
Status: Merged
Merged at revision: 18492
Proposed branch: lp:~cjwatson/launchpad/answers-tests-future-imports
Merge into: lp:launchpad
Diff against target: 330 lines (+50/-8)
22 files modified
lib/lp/answers/browser/tests/test_breadcrumbs.py (+2/-0)
lib/lp/answers/browser/tests/test_menus.py (+2/-0)
lib/lp/answers/browser/tests/test_question.py (+2/-0)
lib/lp/answers/browser/tests/test_questionmessages.py (+2/-0)
lib/lp/answers/browser/tests/test_questionsubscription_views.py (+2/-0)
lib/lp/answers/browser/tests/test_questiontarget.py (+3/-1)
lib/lp/answers/browser/tests/test_views.py (+2/-2)
lib/lp/answers/model/tests/test_question.py (+2/-0)
lib/lp/answers/model/tests/test_questionsubscription.py (+2/-0)
lib/lp/answers/testing.py (+2/-0)
lib/lp/answers/tests/test_doc.py (+2/-0)
lib/lp/answers/tests/test_faq.py (+2/-0)
lib/lp/answers/tests/test_faq_webservice.py (+2/-0)
lib/lp/answers/tests/test_faqtarget.py (+2/-0)
lib/lp/answers/tests/test_publisher.py (+4/-2)
lib/lp/answers/tests/test_question.py (+2/-0)
lib/lp/answers/tests/test_question_notifications.py (+3/-1)
lib/lp/answers/tests/test_question_webservice.py (+2/-0)
lib/lp/answers/tests/test_question_workflow.py (+2/-0)
lib/lp/answers/tests/test_questionjob.py (+2/-0)
lib/lp/answers/tests/test_questiontarget.py (+4/-2)
lib/lp/answers/tests/test_vocabulary.py (+2/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/answers-tests-future-imports
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+332778@code.launchpad.net

Commit message

Convert unit tests under lp.answers to Launchpad's preferred __future__ imports.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)
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/answers/browser/tests/test_breadcrumbs.py'
2--- lib/lp/answers/browser/tests/test_breadcrumbs.py 2014-02-19 00:35:25 +0000
3+++ lib/lp/answers/browser/tests/test_breadcrumbs.py 2017-10-25 12:21:17 +0000
4@@ -1,6 +1,8 @@
5 # Copyright 2009-2010 Canonical Ltd. This software is licensed under the
6 # GNU Affero General Public License version 3 (see the file LICENSE).
7
8+from __future__ import absolute_import, print_function, unicode_literals
9+
10 __metaclass__ = type
11
12 from lp.services.webapp.publisher import canonical_url
13
14=== modified file 'lib/lp/answers/browser/tests/test_menus.py'
15--- lib/lp/answers/browser/tests/test_menus.py 2012-01-01 02:58:52 +0000
16+++ lib/lp/answers/browser/tests/test_menus.py 2017-10-25 12:21:17 +0000
17@@ -1,6 +1,8 @@
18 # Copyright 2009 Canonical Ltd. This software is licensed under the
19 # GNU Affero General Public License version 3 (see the file LICENSE).
20
21+from __future__ import absolute_import, print_function, unicode_literals
22+
23 __metaclass__ = type
24
25 from zope.component import getUtility
26
27=== modified file 'lib/lp/answers/browser/tests/test_question.py'
28--- lib/lp/answers/browser/tests/test_question.py 2014-02-19 04:01:46 +0000
29+++ lib/lp/answers/browser/tests/test_question.py 2017-10-25 12:21:17 +0000
30@@ -3,6 +3,8 @@
31
32 """Tests for the question module."""
33
34+from __future__ import absolute_import, print_function, unicode_literals
35+
36 __metaclass__ = type
37
38 __all__ = []
39
40=== modified file 'lib/lp/answers/browser/tests/test_questionmessages.py'
41--- lib/lp/answers/browser/tests/test_questionmessages.py 2015-09-14 15:56:21 +0000
42+++ lib/lp/answers/browser/tests/test_questionmessages.py 2017-10-25 12:21:17 +0000
43@@ -3,6 +3,8 @@
44
45 """Tests for the various rules around question comment visibility."""
46
47+from __future__ import absolute_import, print_function, unicode_literals
48+
49 __metaclass__ = type
50
51 from zope.component import getUtility
52
53=== modified file 'lib/lp/answers/browser/tests/test_questionsubscription_views.py'
54--- lib/lp/answers/browser/tests/test_questionsubscription_views.py 2012-01-01 02:58:52 +0000
55+++ lib/lp/answers/browser/tests/test_questionsubscription_views.py 2017-10-25 12:21:17 +0000
56@@ -3,6 +3,8 @@
57
58 """Tests for QuestionSubscription views."""
59
60+from __future__ import absolute_import, print_function, unicode_literals
61+
62 __metaclass__ = type
63
64 from lazr.restful.interfaces import IWebServiceClientRequest
65
66=== modified file 'lib/lp/answers/browser/tests/test_questiontarget.py'
67--- lib/lp/answers/browser/tests/test_questiontarget.py 2015-01-29 16:28:30 +0000
68+++ lib/lp/answers/browser/tests/test_questiontarget.py 2017-10-25 12:21:17 +0000
69@@ -3,6 +3,8 @@
70
71 """Test questiontarget views."""
72
73+from __future__ import absolute_import, print_function, unicode_literals
74+
75 __metaclass__ = type
76
77 import os
78@@ -50,7 +52,7 @@
79 product = self.factory.makeProduct()
80 # Avoid non-ascii character in unicode literal to not upset
81 # pocket-lint. Bug #776389.
82- non_ascii_string = u'portugu\xeas'
83+ non_ascii_string = 'portugu\xeas'
84 with person_logged_in(product.owner):
85 self.factory.makeFAQ(product, non_ascii_string)
86 form = {
87
88=== modified file 'lib/lp/answers/browser/tests/test_views.py'
89--- lib/lp/answers/browser/tests/test_views.py 2012-07-24 06:39:54 +0000
90+++ lib/lp/answers/browser/tests/test_views.py 2017-10-25 12:21:17 +0000
91@@ -1,9 +1,9 @@
92 # Copyright 2009-2010 Canonical Ltd. This software is licensed under the
93 # GNU Affero General Public License version 3 (see the file LICENSE).
94
95-"""Test harness for Answer Tracker related unit tests.
96+"""Test harness for Answer Tracker related unit tests."""
97
98-"""
99+from __future__ import absolute_import, print_function, unicode_literals
100
101 __metaclass__ = type
102
103
104=== modified file 'lib/lp/answers/model/tests/test_question.py'
105--- lib/lp/answers/model/tests/test_question.py 2012-01-01 02:58:52 +0000
106+++ lib/lp/answers/model/tests/test_question.py 2017-10-25 12:21:17 +0000
107@@ -1,6 +1,8 @@
108 # Copyright 2011 Canonical Ltd. This software is licensed under the
109 # GNU Affero General Public License version 3 (see the file LICENSE).
110
111+from __future__ import absolute_import, print_function, unicode_literals
112+
113 __metaclass__ = type
114
115 from zope.component import getUtility
116
117=== modified file 'lib/lp/answers/model/tests/test_questionsubscription.py'
118--- lib/lp/answers/model/tests/test_questionsubscription.py 2012-01-01 02:58:52 +0000
119+++ lib/lp/answers/model/tests/test_questionsubscription.py 2017-10-25 12:21:17 +0000
120@@ -3,6 +3,8 @@
121
122 """Tests for the QuestionSubscrption model object.."""
123
124+from __future__ import absolute_import, print_function, unicode_literals
125+
126 __metaclass__ = type
127
128 from zope.component import getUtility
129
130=== modified file 'lib/lp/answers/testing.py'
131--- lib/lp/answers/testing.py 2012-01-01 02:58:52 +0000
132+++ lib/lp/answers/testing.py 2017-10-25 12:21:17 +0000
133@@ -3,6 +3,8 @@
134
135 """Helper functions for Answer Tracker tests."""
136
137+from __future__ import absolute_import, print_function, unicode_literals
138+
139 __metaclass__ = type
140 __all__ = [
141 'QuestionFactory',
142
143=== modified file 'lib/lp/answers/tests/test_doc.py'
144--- lib/lp/answers/tests/test_doc.py 2015-09-28 17:38:45 +0000
145+++ lib/lp/answers/tests/test_doc.py 2017-10-25 12:21:17 +0000
146@@ -5,6 +5,8 @@
147 Run the doctests and pagetests.
148 """
149
150+from __future__ import absolute_import, print_function, unicode_literals
151+
152 import os
153 import unittest
154
155
156=== modified file 'lib/lp/answers/tests/test_faq.py'
157--- lib/lp/answers/tests/test_faq.py 2016-08-23 08:05:44 +0000
158+++ lib/lp/answers/tests/test_faq.py 2017-10-25 12:21:17 +0000
159@@ -3,6 +3,8 @@
160
161 """Tests for IFAQ"""
162
163+from __future__ import absolute_import, print_function, unicode_literals
164+
165 __metaclass__ = type
166
167 import transaction
168
169=== modified file 'lib/lp/answers/tests/test_faq_webservice.py'
170--- lib/lp/answers/tests/test_faq_webservice.py 2015-03-13 06:00:30 +0000
171+++ lib/lp/answers/tests/test_faq_webservice.py 2017-10-25 12:21:17 +0000
172@@ -1,6 +1,8 @@
173 # Copyright 2015 Canonical Ltd. This software is licensed under the
174 # GNU Affero General Public License version 3 (see the file LICENSE).
175
176+from __future__ import absolute_import, print_function, unicode_literals
177+
178 __metaclass__ = type
179
180 from lazr.lifecycle.event import ObjectModifiedEvent
181
182=== modified file 'lib/lp/answers/tests/test_faqtarget.py'
183--- lib/lp/answers/tests/test_faqtarget.py 2012-01-01 02:58:52 +0000
184+++ lib/lp/answers/tests/test_faqtarget.py 2017-10-25 12:21:17 +0000
185@@ -3,6 +3,8 @@
186
187 """Tests for IFAQTarget"""
188
189+from __future__ import absolute_import, print_function, unicode_literals
190+
191 __metaclass__ = type
192
193 from zope.component import getUtility
194
195=== modified file 'lib/lp/answers/tests/test_publisher.py'
196--- lib/lp/answers/tests/test_publisher.py 2012-01-01 02:58:52 +0000
197+++ lib/lp/answers/tests/test_publisher.py 2017-10-25 12:21:17 +0000
198@@ -3,9 +3,11 @@
199
200 """Tests for answers's custom publications."""
201
202+from __future__ import absolute_import, print_function, unicode_literals
203+
204 __metaclass__ = type
205
206-import StringIO
207+import io
208
209 from lp.answers.publisher import (
210 AnswersBrowserRequest,
211@@ -44,7 +46,7 @@
212 def test_response_should_vary_based_on_language(self):
213 # Responses to requests to answers pages have the 'Vary' header set to
214 # include Accept-Language.
215- request = AnswersBrowserRequest(StringIO.StringIO(''), {})
216+ request = AnswersBrowserRequest(io.StringIO(''), {})
217 self.assertEquals(
218 request.response.getHeader('Vary'),
219 'Cookie, Authorization, Accept-Language')
220
221=== modified file 'lib/lp/answers/tests/test_question.py'
222--- lib/lp/answers/tests/test_question.py 2017-10-07 02:32:32 +0000
223+++ lib/lp/answers/tests/test_question.py 2017-10-25 12:21:17 +0000
224@@ -1,6 +1,8 @@
225 # Copyright 2013-2017 Canonical Ltd. This software is licensed under the
226 # GNU Affero General Public License version 3 (see the file LICENSE).
227
228+from __future__ import absolute_import, print_function, unicode_literals
229+
230 __metaclass__ = type
231
232 from testtools.testcase import ExpectedException
233
234=== modified file 'lib/lp/answers/tests/test_question_notifications.py'
235--- lib/lp/answers/tests/test_question_notifications.py 2015-07-08 16:05:11 +0000
236+++ lib/lp/answers/tests/test_question_notifications.py 2017-10-25 12:21:17 +0000
237@@ -1,7 +1,9 @@
238 # Copyright 2009-2010 Canonical Ltd. This software is licensed under the
239 # GNU Affero General Public License version 3 (see the file LICENSE).
240
241-""" Unit-tests for the Answer Tracker Mail Notifications. """
242+"""Unit tests for the Answer Tracker Mail Notifications."""
243+
244+from __future__ import absolute_import, print_function, unicode_literals
245
246 __metaclass__ = type
247
248
249=== modified file 'lib/lp/answers/tests/test_question_webservice.py'
250--- lib/lp/answers/tests/test_question_webservice.py 2016-05-04 09:23:44 +0000
251+++ lib/lp/answers/tests/test_question_webservice.py 2017-10-25 12:21:17 +0000
252@@ -3,6 +3,8 @@
253
254 """Webservice unit tests related to Launchpad Questions."""
255
256+from __future__ import absolute_import, print_function, unicode_literals
257+
258 __metaclass__ = type
259
260 from datetime import (
261
262=== modified file 'lib/lp/answers/tests/test_question_workflow.py'
263--- lib/lp/answers/tests/test_question_workflow.py 2011-12-30 07:38:46 +0000
264+++ lib/lp/answers/tests/test_question_workflow.py 2017-10-25 12:21:17 +0000
265@@ -9,6 +9,8 @@
266 than necessary. This is tested here.
267 """
268
269+from __future__ import absolute_import, print_function, unicode_literals
270+
271 __metaclass__ = type
272
273 __all__ = []
274
275=== modified file 'lib/lp/answers/tests/test_questionjob.py'
276--- lib/lp/answers/tests/test_questionjob.py 2015-08-26 19:38:42 +0000
277+++ lib/lp/answers/tests/test_questionjob.py 2017-10-25 12:21:17 +0000
278@@ -3,6 +3,8 @@
279
280 """Tests for QuestionJobs classes."""
281
282+from __future__ import absolute_import, print_function, unicode_literals
283+
284 __metaclass__ = type
285
286 from testtools.content import Content
287
288=== modified file 'lib/lp/answers/tests/test_questiontarget.py'
289--- lib/lp/answers/tests/test_questiontarget.py 2014-01-30 15:04:06 +0000
290+++ lib/lp/answers/tests/test_questiontarget.py 2017-10-25 12:21:17 +0000
291@@ -3,6 +3,8 @@
292
293 """Tests related to IQuestionTarget."""
294
295+from __future__ import absolute_import, print_function, unicode_literals
296+
297 __metaclass__ = type
298
299 __all__ = []
300@@ -107,7 +109,7 @@
301 langs = [
302 lang.englishname for lang in answer_contact.getLanguagesCache()]
303 # The languages cache has been filled in the correct order.
304- self.failUnlessEqual(langs, [u'English', u'Portuguese (Brazil)'])
305+ self.failUnlessEqual(langs, ['English', 'Portuguese (Brazil)'])
306
307 def test_SourcePackage_implementation_should_prefill_cache(self):
308 # Remove the answer contact's security proxy because we need to call
309@@ -130,7 +132,7 @@
310 langs = [
311 lang.englishname for lang in answer_contact.getLanguagesCache()]
312 # The languages cache has been filled in the correct order.
313- self.failUnlessEqual(langs, [u'English', u'Portuguese (Brazil)'])
314+ self.failUnlessEqual(langs, ['English', 'Portuguese (Brazil)'])
315
316
317 class TestQuestionTargetCreateQuestionFromBug(TestCaseWithFactory):
318
319=== modified file 'lib/lp/answers/tests/test_vocabulary.py'
320--- lib/lp/answers/tests/test_vocabulary.py 2015-10-26 14:54:43 +0000
321+++ lib/lp/answers/tests/test_vocabulary.py 2017-10-25 12:21:17 +0000
322@@ -3,6 +3,8 @@
323
324 """Test the answers domain vocabularies."""
325
326+from __future__ import absolute_import, print_function, unicode_literals
327+
328 __metaclass__ = type
329
330 from lp.answers.vocabulary import (