← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/test-cruft-answers into lp:launchpad/devel

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/test-cruft-answers into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): code


Removes test boilerplate that we no longer need from Answers, and fixes lint in affected tests.
-- 
https://code.launchpad.net/~jtv/launchpad/test-cruft-answers/+merge/30200
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/test-cruft-answers into lp:launchpad/devel.
=== modified file 'lib/lp/answers/browser/tests/test_breadcrumbs.py'
--- lib/lp/answers/browser/tests/test_breadcrumbs.py	2010-04-28 10:13:00 +0000
+++ lib/lp/answers/browser/tests/test_breadcrumbs.py	2010-07-18 00:33:46 +0000
@@ -1,10 +1,8 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
 
-import unittest
-
 from canonical.launchpad.webapp.publisher import canonical_url
 
 from lp.testing import login_person
@@ -35,13 +33,15 @@
             self.project, rootsite='answers')
 
     def test_product(self):
-        crumbs = self.getBreadcrumbsForObject(self.product, rootsite='answers')
+        crumbs = self.getBreadcrumbsForObject(
+            self.product, rootsite='answers')
         last_crumb = crumbs[-1]
         self.assertEquals(last_crumb.url, self.product_questions_url)
         self.assertEquals(last_crumb.text, 'Questions')
 
     def test_project(self):
-        crumbs = self.getBreadcrumbsForObject(self.project, rootsite='answers')
+        crumbs = self.getBreadcrumbsForObject(
+            self.project, rootsite='answers')
         last_crumb = crumbs[-1]
         self.assertEquals(last_crumb.url, self.project_questions_url)
         self.assertEquals(last_crumb.text, 'Questions')
@@ -75,7 +75,3 @@
         crumbs = self.getBreadcrumbsForObject(self.faq)
         last_crumb = crumbs[-1]
         self.assertEquals(last_crumb.text, 'FAQ #%d' % self.faq.id)
-
-
-def test_suite():
-    return unittest.TestLoader().loadTestsFromName(__name__)

=== modified file 'lib/lp/answers/browser/tests/test_question.py'
--- lib/lp/answers/browser/tests/test_question.py	2010-05-19 21:07:07 +0000
+++ lib/lp/answers/browser/tests/test_question.py	2010-07-18 00:33:46 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# 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.
@@ -16,6 +16,7 @@
 from canonical.testing import (
     DatabaseFunctionalLayer, LaunchpadFunctionalLayer)
 
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(LayeredDocFileSuite('question-subscribe_me.txt',
@@ -31,4 +32,3 @@
 
 if __name__ == '__main__':
     unittest.main()
-

=== modified file 'lib/lp/answers/tests/test_doc.py'
--- lib/lp/answers/tests/test_doc.py	2010-02-17 11:19:42 +0000
+++ lib/lp/answers/tests/test_doc.py	2010-07-18 00:33:46 +0000
@@ -1,11 +1,10 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """
 Run the doctests and pagetests.
 """
 
-import logging
 import os
 import unittest
 
@@ -15,7 +14,6 @@
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.product import IProductSet
 from lp.registry.interfaces.projectgroup import IProjectGroupSet
-from canonical.launchpad.testing.pages import PageTestSuite
 from canonical.launchpad.testing.systemdocs import (
     LayeredDocFileSuite, setUp, tearDown)
 from canonical.testing import DatabaseFunctionalLayer
@@ -25,6 +23,7 @@
 
 here = os.path.dirname(os.path.realpath(__file__))
 
+
 def productSetUp(test):
     """Test environment for product."""
     setUp(test)
@@ -64,6 +63,7 @@
     test.globs['collection'] = gnome_project
     test.globs['newFAQ'] = newFAQ
 
+
 def sourcepackageSetUp(test):
     setUp(test)
     ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
@@ -109,10 +109,9 @@
         [('product', productSetUp),
          ('distribution', distributionSetUp),
          ('project', projectSetUp),
-         ])
+         ]),
     }
 
 
 def test_suite():
     return build_test_suite(here, special)
-

=== modified file 'lib/lp/answers/tests/test_question_notifications.py'
--- lib/lp/answers/tests/test_question_notifications.py	2009-06-24 23:10:46 +0000
+++ lib/lp/answers/tests/test_question_notifications.py	2010-07-18 00:33:46 +0000
@@ -1,11 +1,11 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# 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. """
 
 __metaclass__ = type
 
-from unittest import TestCase, TestLoader
+from unittest import TestCase
 
 from zope.interface import implements
 
@@ -48,6 +48,7 @@
     """A fake user."""
     implements(IPerson)
 
+
 class FakeEvent:
     """A fake event."""
     user = FakeUser()
@@ -62,7 +63,7 @@
             StubQuestion(), FakeEvent())
 
     def test_getSubject_no_new_message(self):
-        """Test getSubject() when there is no message added to the question."""
+        """getSubject() when there is no message added to the question."""
         self.assertEquals(
             '[Question #1]: Question title', self.notification.getSubject())
 
@@ -74,7 +75,7 @@
             self.notification.getSubject())
 
     def test_getSubject_new_message_with_reply_prefix(self):
-        """Test getSubject() when there is a new message with a reply prefix."""
+        """getSubject() when there is a new message with a reply prefix."""
         self.notification.new_message = StubQuestionMessage(
             'RE: Message subject')
         self.assertEquals('RE: [Question #1]: Message subject',
@@ -108,9 +109,3 @@
         self.assertEquals(
             'Re: [Question #1]: Message subject',
             self.notification.getSubject())
-
-
-def test_suite():
-    return TestLoader().loadTestsFromName(__name__)
-
-