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
=== modified file 'lib/lp/answers/browser/tests/test_breadcrumbs.py'
--- lib/lp/answers/browser/tests/test_breadcrumbs.py 2014-02-19 00:35:25 +0000
+++ lib/lp/answers/browser/tests/test_breadcrumbs.py 2017-10-25 12:21:17 +0000
@@ -1,6 +1,8 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
57
6from lp.services.webapp.publisher import canonical_url8from lp.services.webapp.publisher import canonical_url
79
=== modified file 'lib/lp/answers/browser/tests/test_menus.py'
--- lib/lp/answers/browser/tests/test_menus.py 2012-01-01 02:58:52 +0000
+++ lib/lp/answers/browser/tests/test_menus.py 2017-10-25 12:21:17 +0000
@@ -1,6 +1,8 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
57
6from zope.component import getUtility8from zope.component import getUtility
79
=== modified file 'lib/lp/answers/browser/tests/test_question.py'
--- lib/lp/answers/browser/tests/test_question.py 2014-02-19 04:01:46 +0000
+++ lib/lp/answers/browser/tests/test_question.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests for the question module."""4"""Tests for the question module."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8__all__ = []10__all__ = []
911
=== modified file 'lib/lp/answers/browser/tests/test_questionmessages.py'
--- lib/lp/answers/browser/tests/test_questionmessages.py 2015-09-14 15:56:21 +0000
+++ lib/lp/answers/browser/tests/test_questionmessages.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests for the various rules around question comment visibility."""4"""Tests for the various rules around question comment visibility."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from zope.component import getUtility10from zope.component import getUtility
911
=== modified file 'lib/lp/answers/browser/tests/test_questionsubscription_views.py'
--- lib/lp/answers/browser/tests/test_questionsubscription_views.py 2012-01-01 02:58:52 +0000
+++ lib/lp/answers/browser/tests/test_questionsubscription_views.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests for QuestionSubscription views."""4"""Tests for QuestionSubscription views."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from lazr.restful.interfaces import IWebServiceClientRequest10from lazr.restful.interfaces import IWebServiceClientRequest
911
=== modified file 'lib/lp/answers/browser/tests/test_questiontarget.py'
--- lib/lp/answers/browser/tests/test_questiontarget.py 2015-01-29 16:28:30 +0000
+++ lib/lp/answers/browser/tests/test_questiontarget.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Test questiontarget views."""4"""Test questiontarget views."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import os10import os
@@ -50,7 +52,7 @@
50 product = self.factory.makeProduct()52 product = self.factory.makeProduct()
51 # Avoid non-ascii character in unicode literal to not upset53 # Avoid non-ascii character in unicode literal to not upset
52 # pocket-lint. Bug #776389.54 # pocket-lint. Bug #776389.
53 non_ascii_string = u'portugu\xeas'55 non_ascii_string = 'portugu\xeas'
54 with person_logged_in(product.owner):56 with person_logged_in(product.owner):
55 self.factory.makeFAQ(product, non_ascii_string)57 self.factory.makeFAQ(product, non_ascii_string)
56 form = {58 form = {
5759
=== modified file 'lib/lp/answers/browser/tests/test_views.py'
--- lib/lp/answers/browser/tests/test_views.py 2012-07-24 06:39:54 +0000
+++ lib/lp/answers/browser/tests/test_views.py 2017-10-25 12:21:17 +0000
@@ -1,9 +1,9 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test harness for Answer Tracker related unit tests.4"""Test harness for Answer Tracker related unit tests."""
55
6"""6from __future__ import absolute_import, print_function, unicode_literals
77
8__metaclass__ = type8__metaclass__ = type
99
1010
=== modified file 'lib/lp/answers/model/tests/test_question.py'
--- lib/lp/answers/model/tests/test_question.py 2012-01-01 02:58:52 +0000
+++ lib/lp/answers/model/tests/test_question.py 2017-10-25 12:21:17 +0000
@@ -1,6 +1,8 @@
1# Copyright 2011 Canonical Ltd. This software is licensed under the1# Copyright 2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
57
6from zope.component import getUtility8from zope.component import getUtility
79
=== modified file 'lib/lp/answers/model/tests/test_questionsubscription.py'
--- lib/lp/answers/model/tests/test_questionsubscription.py 2012-01-01 02:58:52 +0000
+++ lib/lp/answers/model/tests/test_questionsubscription.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests for the QuestionSubscrption model object.."""4"""Tests for the QuestionSubscrption model object.."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from zope.component import getUtility10from zope.component import getUtility
911
=== modified file 'lib/lp/answers/testing.py'
--- lib/lp/answers/testing.py 2012-01-01 02:58:52 +0000
+++ lib/lp/answers/testing.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Helper functions for Answer Tracker tests."""4"""Helper functions for Answer Tracker tests."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
7__all__ = [9__all__ = [
8 'QuestionFactory',10 'QuestionFactory',
911
=== modified file 'lib/lp/answers/tests/test_doc.py'
--- lib/lp/answers/tests/test_doc.py 2015-09-28 17:38:45 +0000
+++ lib/lp/answers/tests/test_doc.py 2017-10-25 12:21:17 +0000
@@ -5,6 +5,8 @@
5Run the doctests and pagetests.5Run the doctests and pagetests.
6"""6"""
77
8from __future__ import absolute_import, print_function, unicode_literals
9
8import os10import os
9import unittest11import unittest
1012
1113
=== modified file 'lib/lp/answers/tests/test_faq.py'
--- lib/lp/answers/tests/test_faq.py 2016-08-23 08:05:44 +0000
+++ lib/lp/answers/tests/test_faq.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests for IFAQ"""4"""Tests for IFAQ"""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import transaction10import transaction
911
=== modified file 'lib/lp/answers/tests/test_faq_webservice.py'
--- lib/lp/answers/tests/test_faq_webservice.py 2015-03-13 06:00:30 +0000
+++ lib/lp/answers/tests/test_faq_webservice.py 2017-10-25 12:21:17 +0000
@@ -1,6 +1,8 @@
1# Copyright 2015 Canonical Ltd. This software is licensed under the1# Copyright 2015 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
57
6from lazr.lifecycle.event import ObjectModifiedEvent8from lazr.lifecycle.event import ObjectModifiedEvent
79
=== modified file 'lib/lp/answers/tests/test_faqtarget.py'
--- lib/lp/answers/tests/test_faqtarget.py 2012-01-01 02:58:52 +0000
+++ lib/lp/answers/tests/test_faqtarget.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests for IFAQTarget"""4"""Tests for IFAQTarget"""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from zope.component import getUtility10from zope.component import getUtility
911
=== modified file 'lib/lp/answers/tests/test_publisher.py'
--- lib/lp/answers/tests/test_publisher.py 2012-01-01 02:58:52 +0000
+++ lib/lp/answers/tests/test_publisher.py 2017-10-25 12:21:17 +0000
@@ -3,9 +3,11 @@
33
4"""Tests for answers's custom publications."""4"""Tests for answers's custom publications."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import StringIO10import io
911
10from lp.answers.publisher import (12from lp.answers.publisher import (
11 AnswersBrowserRequest,13 AnswersBrowserRequest,
@@ -44,7 +46,7 @@
44 def test_response_should_vary_based_on_language(self):46 def test_response_should_vary_based_on_language(self):
45 # Responses to requests to answers pages have the 'Vary' header set to47 # Responses to requests to answers pages have the 'Vary' header set to
46 # include Accept-Language.48 # include Accept-Language.
47 request = AnswersBrowserRequest(StringIO.StringIO(''), {})49 request = AnswersBrowserRequest(io.StringIO(''), {})
48 self.assertEquals(50 self.assertEquals(
49 request.response.getHeader('Vary'),51 request.response.getHeader('Vary'),
50 'Cookie, Authorization, Accept-Language')52 'Cookie, Authorization, Accept-Language')
5153
=== modified file 'lib/lp/answers/tests/test_question.py'
--- lib/lp/answers/tests/test_question.py 2017-10-07 02:32:32 +0000
+++ lib/lp/answers/tests/test_question.py 2017-10-25 12:21:17 +0000
@@ -1,6 +1,8 @@
1# Copyright 2013-2017 Canonical Ltd. This software is licensed under the1# Copyright 2013-2017 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
57
6from testtools.testcase import ExpectedException8from testtools.testcase import ExpectedException
79
=== modified file 'lib/lp/answers/tests/test_question_notifications.py'
--- lib/lp/answers/tests/test_question_notifications.py 2015-07-08 16:05:11 +0000
+++ lib/lp/answers/tests/test_question_notifications.py 2017-10-25 12:21:17 +0000
@@ -1,7 +1,9 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4""" Unit-tests for the Answer Tracker Mail Notifications. """4"""Unit tests for the Answer Tracker Mail Notifications."""
5
6from __future__ import absolute_import, print_function, unicode_literals
57
6__metaclass__ = type8__metaclass__ = type
79
810
=== modified file 'lib/lp/answers/tests/test_question_webservice.py'
--- lib/lp/answers/tests/test_question_webservice.py 2016-05-04 09:23:44 +0000
+++ lib/lp/answers/tests/test_question_webservice.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Webservice unit tests related to Launchpad Questions."""4"""Webservice unit tests related to Launchpad Questions."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from datetime import (10from datetime import (
911
=== modified file 'lib/lp/answers/tests/test_question_workflow.py'
--- lib/lp/answers/tests/test_question_workflow.py 2011-12-30 07:38:46 +0000
+++ lib/lp/answers/tests/test_question_workflow.py 2017-10-25 12:21:17 +0000
@@ -9,6 +9,8 @@
9than necessary. This is tested here.9than necessary. This is tested here.
10"""10"""
1111
12from __future__ import absolute_import, print_function, unicode_literals
13
12__metaclass__ = type14__metaclass__ = type
1315
14__all__ = []16__all__ = []
1517
=== modified file 'lib/lp/answers/tests/test_questionjob.py'
--- lib/lp/answers/tests/test_questionjob.py 2015-08-26 19:38:42 +0000
+++ lib/lp/answers/tests/test_questionjob.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests for QuestionJobs classes."""4"""Tests for QuestionJobs classes."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from testtools.content import Content10from testtools.content import Content
911
=== modified file 'lib/lp/answers/tests/test_questiontarget.py'
--- lib/lp/answers/tests/test_questiontarget.py 2014-01-30 15:04:06 +0000
+++ lib/lp/answers/tests/test_questiontarget.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Tests related to IQuestionTarget."""4"""Tests related to IQuestionTarget."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8__all__ = []10__all__ = []
@@ -107,7 +109,7 @@
107 langs = [109 langs = [
108 lang.englishname for lang in answer_contact.getLanguagesCache()]110 lang.englishname for lang in answer_contact.getLanguagesCache()]
109 # The languages cache has been filled in the correct order.111 # The languages cache has been filled in the correct order.
110 self.failUnlessEqual(langs, [u'English', u'Portuguese (Brazil)'])112 self.failUnlessEqual(langs, ['English', 'Portuguese (Brazil)'])
111113
112 def test_SourcePackage_implementation_should_prefill_cache(self):114 def test_SourcePackage_implementation_should_prefill_cache(self):
113 # Remove the answer contact's security proxy because we need to call115 # Remove the answer contact's security proxy because we need to call
@@ -130,7 +132,7 @@
130 langs = [132 langs = [
131 lang.englishname for lang in answer_contact.getLanguagesCache()]133 lang.englishname for lang in answer_contact.getLanguagesCache()]
132 # The languages cache has been filled in the correct order.134 # The languages cache has been filled in the correct order.
133 self.failUnlessEqual(langs, [u'English', u'Portuguese (Brazil)'])135 self.failUnlessEqual(langs, ['English', 'Portuguese (Brazil)'])
134136
135137
136class TestQuestionTargetCreateQuestionFromBug(TestCaseWithFactory):138class TestQuestionTargetCreateQuestionFromBug(TestCaseWithFactory):
137139
=== modified file 'lib/lp/answers/tests/test_vocabulary.py'
--- lib/lp/answers/tests/test_vocabulary.py 2015-10-26 14:54:43 +0000
+++ lib/lp/answers/tests/test_vocabulary.py 2017-10-25 12:21:17 +0000
@@ -3,6 +3,8 @@
33
4"""Test the answers domain vocabularies."""4"""Test the answers domain vocabularies."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from lp.answers.vocabulary import (10from lp.answers.vocabulary import (