← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/answers-tests-future-imports into lp:launchpad.

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/answers-tests-future-imports/+merge/332778
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/answers-tests-future-imports into lp:launchpad.
=== 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 @@
 # Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.services.webapp.publisher import canonical_url

=== 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 @@
 # Copyright 2009 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== 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 @@
 
 """Tests for the question module."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 __all__ = []

=== 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 @@
 
 """Tests for the various rules around question comment visibility."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== 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 @@
 
 """Tests for QuestionSubscription views."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lazr.restful.interfaces import IWebServiceClientRequest

=== 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 @@
 
 """Test questiontarget views."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import os
@@ -50,7 +52,7 @@
         product = self.factory.makeProduct()
         # Avoid non-ascii character in unicode literal to not upset
         # pocket-lint. Bug #776389.
-        non_ascii_string = u'portugu\xeas'
+        non_ascii_string = 'portugu\xeas'
         with person_logged_in(product.owner):
             self.factory.makeFAQ(product, non_ascii_string)
         form = {

=== 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 @@
 # Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-"""Test harness for Answer Tracker related unit tests.
+"""Test harness for Answer Tracker related unit tests."""
 
-"""
+from __future__ import absolute_import, print_function, unicode_literals
 
 __metaclass__ = type
 

=== 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 @@
 # Copyright 2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== 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 @@
 
 """Tests for the QuestionSubscrption model object.."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== 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 @@
 
 """Helper functions for Answer Tracker tests."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 __all__ = [
     'QuestionFactory',

=== 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 @@
 Run the doctests and pagetests.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 import os
 import unittest
 

=== 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 @@
 
 """Tests for IFAQ"""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 import transaction

=== 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 @@
 # Copyright 2015 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lazr.lifecycle.event import ObjectModifiedEvent

=== 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 @@
 
 """Tests for IFAQTarget"""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.component import getUtility

=== 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 @@
 
 """Tests for answers's custom publications."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
-import StringIO
+import io
 
 from lp.answers.publisher import (
     AnswersBrowserRequest,
@@ -44,7 +46,7 @@
     def test_response_should_vary_based_on_language(self):
         # Responses to requests to answers pages have the 'Vary' header set to
         # include Accept-Language.
-        request = AnswersBrowserRequest(StringIO.StringIO(''), {})
+        request = AnswersBrowserRequest(io.StringIO(''), {})
         self.assertEquals(
             request.response.getHeader('Vary'),
             'Cookie, Authorization, Accept-Language')

=== 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 @@
 # Copyright 2013-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from testtools.testcase import ExpectedException

=== 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 @@
 # Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-""" Unit-tests for the Answer Tracker Mail Notifications. """
+"""Unit tests for the Answer Tracker Mail Notifications."""
+
+from __future__ import absolute_import, print_function, unicode_literals
 
 __metaclass__ = type
 

=== 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 @@
 
 """Webservice unit tests related to Launchpad Questions."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from datetime import (

=== 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 @@
 than necessary. This is tested here.
 """
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 __all__ = []

=== 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 @@
 
 """Tests for QuestionJobs classes."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from testtools.content import Content

=== 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 @@
 
 """Tests related to IQuestionTarget."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 __all__ = []
@@ -107,7 +109,7 @@
         langs = [
             lang.englishname for lang in answer_contact.getLanguagesCache()]
         # The languages cache has been filled in the correct order.
-        self.failUnlessEqual(langs, [u'English', u'Portuguese (Brazil)'])
+        self.failUnlessEqual(langs, ['English', 'Portuguese (Brazil)'])
 
     def test_SourcePackage_implementation_should_prefill_cache(self):
         # Remove the answer contact's security proxy because we need to call
@@ -130,7 +132,7 @@
         langs = [
             lang.englishname for lang in answer_contact.getLanguagesCache()]
         # The languages cache has been filled in the correct order.
-        self.failUnlessEqual(langs, [u'English', u'Portuguese (Brazil)'])
+        self.failUnlessEqual(langs, ['English', 'Portuguese (Brazil)'])
 
 
 class TestQuestionTargetCreateQuestionFromBug(TestCaseWithFactory):

=== 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 @@
 
 """Test the answers domain vocabularies."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from lp.answers.vocabulary import (


Follow ups