launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00089
[Merge] lp:~jml/launchpad/real-doctest into lp:launchpad/devel
Jonathan Lange has proposed merging lp:~jml/launchpad/real-doctest into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch changes Launchpad to not use the deprecated zope.testing.doctest, and instead use Python standard library doctest.
It also deletes some commented out code.
--
https://code.launchpad.net/~jml/launchpad/real-doctest/+merge/29877
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jml/launchpad/real-doctest into lp:launchpad/devel.
=== modified file 'lib/canonical/buildd/tests/test_harness.py'
--- lib/canonical/buildd/tests/test_harness.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/buildd/tests/test_harness.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing import doctest
+import doctest
def test_suite():
return doctest.DocTestSuite('canonical.buildd.tests.harness')
=== modified file 'lib/canonical/config/tests/test_config.py'
--- lib/canonical/config/tests/test_config.py 2009-08-05 18:52:52 +0000
+++ lib/canonical/config/tests/test_config.py 2010-07-14 14:34:44 +0000
@@ -10,11 +10,11 @@
__metaclass__ = type
import ZConfig
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
import os
import pkg_resources
import unittest
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
from lazr.config import ConfigSchema
from lazr.config.interfaces import ConfigErrors
=== modified file 'lib/canonical/database/ftests/test_postgresql.py'
--- lib/canonical/database/ftests/test_postgresql.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/database/ftests/test_postgresql.py 2010-07-14 14:34:44 +0000
@@ -3,8 +3,9 @@
__metaclass__ = type
+from doctest import DocTestSuite
+
from canonical.ftests.pgsql import PgTestSetup
-from zope.testing.doctest import DocTestSuite
def setUp(test):
=== modified file 'lib/canonical/database/tests/test_sqlbase.py'
--- lib/canonical/database/tests/test_sqlbase.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/database/tests/test_sqlbase.py 2010-07-14 14:34:44 +0000
@@ -4,7 +4,7 @@
from canonical.database import sqlbase
import unittest, doctest
-from zope.testing.doctest import ELLIPSIS, NORMALIZE_WHITESPACE, REPORT_NDIFF
+from doctest import ELLIPSIS, NORMALIZE_WHITESPACE, REPORT_NDIFF
def test_suite():
=== modified file 'lib/canonical/launchpad/database/message.py'
--- lib/canonical/launchpad/database/message.py 2009-07-17 00:26:05 +0000
+++ lib/canonical/launchpad/database/message.py 2010-07-14 14:34:44 +0000
@@ -706,7 +706,6 @@
"""
# Count the number of messages from the sender since the throttle
# date.
- store = Store.of(self.sender)
messages_sent = self._getThrottlers(after).count()
return messages_sent < config.launchpad.user_to_user_max_messages
=== modified file 'lib/canonical/launchpad/database/tests/test_message.py'
--- lib/canonical/launchpad/database/tests/test_message.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/database/tests/test_message.py 2010-07-14 14:34:44 +0000
@@ -4,6 +4,7 @@
__metaclass__ = type
from cStringIO import StringIO
+from doctest import DocTestSuite
from email.Message import Message
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
@@ -13,7 +14,6 @@
from canonical.testing import LaunchpadFunctionalLayer
from sqlobject import SQLObjectNotFound
-from zope.testing.doctestunit import DocTestSuite
from zope.component import getUtility
from canonical.launchpad.database import (
=== modified file 'lib/canonical/launchpad/mail/ftests/test_stub.py'
--- lib/canonical/launchpad/mail/ftests/test_stub.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/mail/ftests/test_stub.py 2010-07-14 14:34:44 +0000
@@ -3,9 +3,10 @@
__metaclass__ = type
+from doctest import DocTestSuite
import unittest
import re
-from zope.testing.doctest import DocTestSuite
+
from zope.testing.renormalizing import RENormalizing
from canonical.testing import LaunchpadFunctionalLayer
=== modified file 'lib/canonical/launchpad/mail/tests/test_commands.py'
--- lib/canonical/launchpad/mail/tests/test_commands.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/mail/tests/test_commands.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
import unittest
-from zope.testing.doctest import DocTestSuite
+from doctest import DocTestSuite
def test_suite():
=== modified file 'lib/canonical/launchpad/mail/tests/test_handlers.py'
--- lib/canonical/launchpad/mail/tests/test_handlers.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/mail/tests/test_handlers.py 2010-07-14 14:34:44 +0000
@@ -5,7 +5,7 @@
import unittest
-from zope.testing.doctest import DocTestSuite
+from doctest import DocTestSuite
from canonical.launchpad.mail.commands import BugEmailCommand
from canonical.launchpad.mail.handlers import MaloneHandler
=== modified file 'lib/canonical/launchpad/mail/tests/test_helpers.py'
--- lib/canonical/launchpad/mail/tests/test_helpers.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/mail/tests/test_helpers.py 2010-07-14 14:34:44 +0000
@@ -3,10 +3,10 @@
__metaclass__ = type
+from doctest import DocTestSuite
import unittest
from zope.interface import directlyProvides, directlyProvidedBy
-from zope.testing.doctest import DocTestSuite
from canonical.launchpad.interfaces.mail import (
EmailProcessingError, IWeaklyAuthenticatedPrincipal)
=== modified file 'lib/canonical/launchpad/mail/tests/test_incoming.py'
--- lib/canonical/launchpad/mail/tests/test_incoming.py 2010-06-01 01:14:42 +0000
+++ lib/canonical/launchpad/mail/tests/test_incoming.py 2010-07-14 14:34:44 +0000
@@ -1,11 +1,11 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from doctest import DocTestSuite
import os
import unittest
import transaction
-from zope.testing.doctest import DocTestSuite
from canonical.launchpad.mail.ftests.helpers import testmails_path
from canonical.launchpad.mail.incoming import handleMail, MailErrorUtility
=== modified file 'lib/canonical/launchpad/mailman/config/tests/test_config.py'
--- lib/canonical/launchpad/mailman/config/tests/test_config.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/mailman/config/tests/test_config.py 2010-07-14 14:34:44 +0000
@@ -1,7 +1,7 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
def test_suite():
suite = DocTestSuite(
=== modified file 'lib/canonical/launchpad/scripts/tests/test_rundoctests.py'
--- lib/canonical/launchpad/scripts/tests/test_rundoctests.py 2010-03-07 00:31:23 +0000
+++ lib/canonical/launchpad/scripts/tests/test_rundoctests.py 2010-07-14 14:34:44 +0000
@@ -3,10 +3,9 @@
__metaclass__ = type
+from doctest import DocTestSuite
import unittest
-from zope.testing.doctestunit import DocTestSuite
-
from canonical.testing import reset_logging
def tearDown(test):
=== modified file 'lib/canonical/launchpad/testing/pages.py'
--- lib/canonical/launchpad/testing/pages.py 2010-06-14 18:14:28 +0000
+++ lib/canonical/launchpad/testing/pages.py 2010-07-14 14:34:44 +0000
@@ -9,6 +9,7 @@
__metaclass__ = type
+import doctest
import os
import pdb
import pprint
@@ -26,11 +27,8 @@
from zope.app.testing.functional import HTTPCaller, SimpleCookie
from zope.component import getUtility
from zope.testbrowser.testing import Browser
-from zope.testing import doctest
from zope.security.proxy import removeSecurityProxy
-from launchpadlib.launchpad import Launchpad
-
from canonical.launchpad.interfaces import (
IOAuthConsumerSet, OAUTH_REALM, ILaunchpadCelebrities,
TeamMembershipStatus)
=== modified file 'lib/canonical/launchpad/testing/systemdocs.py'
--- lib/canonical/launchpad/testing/systemdocs.py 2010-04-23 20:41:06 +0000
+++ lib/canonical/launchpad/testing/systemdocs.py 2010-07-14 14:34:44 +0000
@@ -17,6 +17,7 @@
'tearDown',
]
+import doctest
import logging
import os
import pdb
@@ -25,7 +26,6 @@
import transaction
from zope.component import getUtility
-from zope.testing import doctest
from zope.testing.loggingsupport import Handler
from canonical.chunkydiff import elided_source
@@ -60,12 +60,11 @@
class FilePrefixStrippingDocTestParser(doctest.DocTestParser):
"""A DocTestParser that strips a prefix from doctests."""
- def get_doctest(self, string, globs, name, filename, lineno,
- optionflags=0):
+
+ def get_doctest(self, string, globs, name, filename, lineno):
filename = strip_prefix(filename)
return doctest.DocTestParser.get_doctest(
- self, string, globs, name, filename, lineno,
- optionflags=optionflags)
+ self, string, globs, name, filename, lineno)
default_parser = FilePrefixStrippingDocTestParser()
=== modified file 'lib/canonical/launchpad/testing/tests/test_googleharness.py'
--- lib/canonical/launchpad/testing/tests/test_googleharness.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/testing/tests/test_googleharness.py 2010-07-14 14:34:44 +0000
@@ -1,7 +1,7 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-from zope.testing import doctest
+import doctest
def test_suite():
return doctest.DocTestSuite(
=== modified file 'lib/canonical/launchpad/testing/tests/test_systemdocs.py'
--- lib/canonical/launchpad/testing/tests/test_systemdocs.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/testing/tests/test_systemdocs.py 2010-07-14 14:34:44 +0000
@@ -5,14 +5,13 @@
__metaclass__ = type
+import doctest
import logging
import os
import shutil
import tempfile
import unittest
-from zope.testing import doctest
-
from canonical.config import config
from canonical.launchpad.testing.systemdocs import (
default_optionflags, LayeredDocFileSuite)
=== modified file 'lib/canonical/launchpad/tests/test_datetimeutils.py'
--- lib/canonical/launchpad/tests/test_datetimeutils.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/tests/test_datetimeutils.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
import unittest
-from zope.testing.doctest import DocTestSuite
+from doctest import DocTestSuite
from canonical.launchpad import datetimeutils
=== modified file 'lib/canonical/launchpad/tests/test_helpers.py'
--- lib/canonical/launchpad/tests/test_helpers.py 2010-04-26 16:00:31 +0000
+++ lib/canonical/launchpad/tests/test_helpers.py 2010-07-14 14:34:44 +0000
@@ -1,10 +1,10 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from doctest import DocTestSuite
import unittest
from canonical.testing import LaunchpadFunctionalLayer
-from zope.testing.doctest import DocTestSuite
from zope.publisher.interfaces.browser import IBrowserRequest
from zope.interface import implements
=== modified file 'lib/canonical/launchpad/tests/test_rundoctests.py'
--- lib/canonical/launchpad/tests/test_rundoctests.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/tests/test_rundoctests.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing.doctestunit import DocTestSuite
+from doctest import DocTestSuite
def test_suite():
return DocTestSuite('canonical.launchpad.helpers')
=== modified file 'lib/canonical/launchpad/webapp/ftests/test_vhosts.py'
--- lib/canonical/launchpad/webapp/ftests/test_vhosts.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/webapp/ftests/test_vhosts.py 2010-07-14 14:34:44 +0000
@@ -5,7 +5,7 @@
__metaclass__ = type
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
def test_suite():
suite = DocTestSuite(
=== modified file 'lib/canonical/launchpad/webapp/tests/test___init__.py'
--- lib/canonical/launchpad/webapp/tests/test___init__.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/webapp/tests/test___init__.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
def test_suite():
suite = DocTestSuite(
=== modified file 'lib/canonical/launchpad/webapp/tests/test_batching.py'
--- lib/canonical/launchpad/webapp/tests/test_batching.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/webapp/tests/test_batching.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
def test_suite():
suite = DocTestSuite(
=== modified file 'lib/canonical/launchpad/webapp/tests/test_notifications.py'
--- lib/canonical/launchpad/webapp/tests/test_notifications.py 2009-10-21 20:47:13 +0000
+++ lib/canonical/launchpad/webapp/tests/test_notifications.py 2010-07-14 14:34:44 +0000
@@ -5,9 +5,9 @@
__metaclass__ = type
+from doctest import DocTestSuite
import unittest
-from zope.testing.doctest import DocTestSuite
from zope.interface import implements
from zope.session.interfaces import ISession, ISessionData
from zope.app.testing import ztapi, placelesssetup
=== modified file 'lib/canonical/launchpad/webapp/tests/test_publisher.py'
--- lib/canonical/launchpad/webapp/tests/test_publisher.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/webapp/tests/test_publisher.py 2010-07-14 14:34:44 +0000
@@ -1,8 +1,9 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from doctest import DocTestSuite, ELLIPSIS
import unittest
-from zope.testing.doctest import DocTestSuite, ELLIPSIS
+
from canonical.launchpad.webapp import publisher
def test_suite():
=== modified file 'lib/canonical/launchpad/webapp/tests/test_servers.py'
--- lib/canonical/launchpad/webapp/tests/test_servers.py 2010-04-27 15:56:20 +0000
+++ lib/canonical/launchpad/webapp/tests/test_servers.py 2010-07-14 14:34:44 +0000
@@ -5,11 +5,11 @@
__metaclass__ = type
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
import StringIO
import unittest
from zope.component import getGlobalSiteManager, getUtility
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
from zope.interface import implements, Interface
from lazr.restful.interfaces import (
=== modified file 'lib/canonical/launchpad/webapp/tests/test_sorting.py'
--- lib/canonical/launchpad/webapp/tests/test_sorting.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/webapp/tests/test_sorting.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
def test_suite():
suite = DocTestSuite(
=== modified file 'lib/canonical/launchpad/webapp/tests/test_tales.py'
--- lib/canonical/launchpad/webapp/tests/test_tales.py 2010-06-14 04:23:37 +0000
+++ lib/canonical/launchpad/webapp/tests/test_tales.py 2010-07-14 14:34:44 +0000
@@ -5,7 +5,7 @@
import unittest
-from zope.testing.doctestunit import DocTestSuite
+from doctest import DocTestSuite
def test_requestapi():
=== modified file 'lib/canonical/launchpad/webapp/tests/test_url.py'
--- lib/canonical/launchpad/webapp/tests/test_url.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/webapp/tests/test_url.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
def test_suite():
suite = DocTestSuite(
=== modified file 'lib/canonical/librarian/ftests/test_harness.py'
--- lib/canonical/librarian/ftests/test_harness.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/librarian/ftests/test_harness.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing import doctest
+import doctest
def test_suite():
return doctest.DocTestSuite(
=== modified file 'lib/canonical/lp/ftests/test_zopeless.py'
--- lib/canonical/lp/ftests/test_zopeless.py 2010-04-15 00:36:22 +0000
+++ lib/canonical/lp/ftests/test_zopeless.py 2010-07-14 14:34:44 +0000
@@ -4,13 +4,14 @@
"""
Tests to make sure that initZopeless works as expected.
"""
+
+from doctest import DocTestSuite
from threading import Thread
import unittest
import warnings
import psycopg2
from sqlobject import StringCol, IntCol
-from zope.testing.doctest import DocTestSuite
from canonical.database.sqlbase import SQLBase, alreadyInstalledMsg, cursor
from canonical.ftests.pgsql import PgTestSetup
=== modified file 'lib/canonical/testing/tests/test_doctestcodec.py'
--- lib/canonical/testing/tests/test_doctestcodec.py 2009-07-17 02:25:09 +0000
+++ lib/canonical/testing/tests/test_doctestcodec.py 2010-07-14 14:34:44 +0000
@@ -6,10 +6,9 @@
__metaclass__ = type
__all__ = []
+from doctest import DocTestSuite
import unittest
-from zope.testing.doctestunit import DocTestSuite
-
import canonical.testing.doctestcodec
def test_suite():
=== modified file 'lib/canonical/testing/tests/test_mockdb.py'
--- lib/canonical/testing/tests/test_mockdb.py 2009-08-05 18:52:52 +0000
+++ lib/canonical/testing/tests/test_mockdb.py 2010-07-14 14:34:44 +0000
@@ -6,17 +6,16 @@
__metaclass__ = type
__all__ = []
+from doctest import DocTestSuite
import os
import os.path
import unittest
-from zope.testing.doctestunit import DocTestSuite
-#from zope.testing.testrunner import dont_retry, RetryTest
-
from canonical.testing import mockdb
class MockDbTestCase(unittest.TestCase):
+
def setUp(self):
self.script_filename = mockdb.script_filename('_mockdb_unittest')
@@ -24,7 +23,6 @@
if os.path.exists(self.script_filename):
os.unlink(self.script_filename)
- #@dont_retry
def testSerialize(self):
# Ensure the scripts can store and retrieve their logs
recorder = mockdb.ScriptRecorder(self.script_filename)
@@ -34,29 +32,6 @@
replayer = mockdb.ScriptPlayer(self.script_filename)
self.failUnlessEqual(replayer.log, ['Arbitrary Data'])
- #@dont_retry
- #def testHandleInvalidScript(self):
- # Ensure a RetryTest exception is raised and the invalid script
- # file removed when handleInvalidScript() is called
- # recorder = mockdb.ScriptRecorder(self.script_filename)
- # recorder.store()
-
- # replayer = mockdb.ScriptPlayer(self.script_filename)
-
- # self.assertRaises(
- # RetryTest, replayer.handleInvalidScript, 'Reason')
- # self.failIf(os.path.exists(self.script_filename))
-
- #@dont_retry
- #def testShortScript(self):
- # Ensure a RetryTest exception is raised if an attempt is made
- # to pull results from an exhausted script.
- # recorder = mockdb.ScriptRecorder(self.script_filename)
- # recorder.store()
- # replayer = mockdb.ScriptPlayer(self.script_filename)
- # self.assertRaises(RetryTest, replayer.getNextEntry, None, None)
-
- #@dont_retry
def testScriptFilename(self):
# Ensure evil characters in the key don't mess up the script_filename
# results. Only '/' is really evil - other chars should all work
@@ -83,122 +58,9 @@
_retry_count = 0
- # This test does not use @dont_retry.
- # It needs to leak RetryTest exeptions as it tests that the
- # test runner is handling them correctly.
- #def testRetryTestRetriesTest(self):
- # The first time this test is run it raises a RetryTest exception.
- # The second time it is run it succeeds. This means that this
- # test will fail if RetryTest handling is not being done correctly
- # (as the test will have raised an exception), and succeed if
- # RetryTest handling is working (because it succeeds on retry).
- # This test should really be upstream in zope.testing but
- # is here so Launchpad can confirm that the correctly patched
- # version of zope.testing is in use and to minimize the zope.testing
- # patch until we decide if RetryTest handling is to be pushed
- # upstream or not.
- # MockDbTestCase._retry_count += 1
- # if MockDbTestCase._retry_count % 2 == 1:
- # raise RetryTest(
- # "Testing RetryTest behavior. This exception will be raised "
- # "but the test runner doesn't consider it a failure")
-
_doctest_retry_count = 0
-#def retry_on_odd_numbered_calls():
-# """Helper for doctest RetryTest test.
-
-# This helper raises a RetryTest exception on odd numbered calls,
-# and prints 'Retry not raised' on even numbered calls.
-
-# >>> try:
-# ... retry_on_odd_numbered_calls()
-# ... except RetryTest:
-# ... print "Caught RetryTest."
-# ...
-# Retry raised.
-# Caught RetryTest.
-# >>> try:
-# ... retry_on_odd_numbered_calls()
-# ... except RetryTest:
-# ... print "Caught RetryTest."
-# ...
-# Retry not raised.
-# """
-# global _doctest_retry_count
-# _doctest_retry_count += 1
-# if _doctest_retry_count % 2 == 1:
-# print "Retry raised."
-# raise RetryTest
-# print "Retry not raised."
-
-
-#def testRetryTestInDoctest_will_raise_but_testrunner_ignores_it():
-# """Test a RetryTest exception in a doctest works as expected.
-
-# This doctest raises a RetryTest exception the first time it is run.
-# On the second run, it succeeds.
-
-# If the testrunner is correctly handling RetryTest exceptions raised
-# by doctests, then the RetryTest exception will not be reported as
-# a failure. This test will then be rerun and succeed.
-
-# If the testrunner is not correctly handling RetryTest exceptions,
-# then the RetryTesst exception will be flagged as an error.
-
-# This test confirms that a RetryException raised where no exception
-# was expected works.
-
-# >>> retry_on_odd_numbered_calls()
-# Retry not raised.
-# """
-
-
-#def retry_on_odd_numbered_calls2():
-# """Helper for doctest RetryTest test.
-
-# This helper raises a RetryTest exception on odd numbered calls,
-# and a RuntimeError on even numbered calls.
-
-# >>> try:
-# ... retry_on_odd_numbered_calls2()
-# ... except RetryTest:
-# ... print "Caught RetryTest."
-# ...
-# Retry raised.
-# Caught RetryTest.
-# >>> try:
-# ... retry_on_odd_numbered_calls2()
-# ... except RetryTest:
-# ... print "Caught RetryTest."
-# ...
-# Traceback (most recent call last):
-# ...
-# RuntimeError: Retry not raised.
-# """
-# global _doctest_retry_count
-# _doctest_retry_count += 1
-# if _doctest_retry_count % 2 == 1:
-# print "Retry raised."
-# raise RetryTest
-# raise RuntimeError("Retry not raised.")
-
-
-#def testRetryTestInDoctest2():
-# """Test a RetryTest exception in a doctest works as expected.
-
-# This test is the same as testRetryTestInDoctest, except it confirms
-# that a RetryException raised where a different exception was expected
-# works.
-
-# >>> retry_on_odd_numbered_calls2()
-# Traceback (most recent call last):
-# ...
-# RuntimeError: Retry not raised.
-# """
-
-
def test_suite():
suite = unittest.TestSuite()
=== modified file 'lib/canonical/tests/test_base.py'
--- lib/canonical/tests/test_base.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/tests/test_base.py 2010-07-14 14:34:44 +0000
@@ -1,8 +1,8 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from doctest import DocTestSuite
import unittest
-from zope.testing.doctestunit import DocTestSuite
import canonical.base
def test_suite():
=== modified file 'lib/canonical/tests/test_cachedproperty.py'
--- lib/canonical/tests/test_cachedproperty.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/tests/test_cachedproperty.py 2010-07-14 14:34:44 +0000
@@ -1,8 +1,9 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from doctest import DocTestSuite, ELLIPSIS
import unittest
-from zope.testing.doctest import DocTestSuite, ELLIPSIS
+
import canonical.cachedproperty
def test_suite():
=== modified file 'lib/canonical/tests/test_encoding.py'
--- lib/canonical/tests/test_encoding.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/tests/test_encoding.py 2010-07-14 14:34:44 +0000
@@ -1,8 +1,9 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from doctest import DocTestSuite, ELLIPSIS
import unittest
-from zope.testing.doctest import DocTestSuite, ELLIPSIS
+
import canonical.encoding
def test_suite():
=== modified file 'lib/canonical/zeca/ftests/test_harness.py'
--- lib/canonical/zeca/ftests/test_harness.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/zeca/ftests/test_harness.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
__metaclass__ = type
-from zope.testing import doctest
+import doctest
from canonical.launchpad.testing.systemdocs import default_optionflags
=== modified file 'lib/lp/app/browser/tests/test_stringformatter.py'
--- lib/lp/app/browser/tests/test_stringformatter.py 2010-06-14 04:23:37 +0000
+++ lib/lp/app/browser/tests/test_stringformatter.py 2010-07-14 14:34:44 +0000
@@ -5,11 +5,11 @@
__metaclass__ = type
+from doctest import DocTestSuite
from textwrap import dedent
import unittest
from zope.component import getUtility
-from zope.testing.doctestunit import DocTestSuite
from canonical.config import config
from canonical.launchpad.testing.pages import find_tags_by_class
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py 2010-06-05 10:41:52 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py 2010-07-14 14:34:44 +0000
@@ -4,10 +4,10 @@
__metaclass__ = type
+from doctest import DocTestSuite
import unittest
from zope.security.proxy import removeSecurityProxy
-from zope.testing.doctest import DocTestSuite
from canonical.launchpad.ftests import ANONYMOUS, login, login_person
from canonical.launchpad.testing.systemdocs import (
=== modified file 'lib/lp/bugs/tests/test_bugtask.py'
--- lib/lp/bugs/tests/test_bugtask.py 2010-06-24 17:09:14 +0000
+++ lib/lp/bugs/tests/test_bugtask.py 2010-07-14 14:34:44 +0000
@@ -4,11 +4,11 @@
__metaclass__ = type
from datetime import timedelta
+from doctest import DocTestSuite
import unittest
from zope.component import getUtility
from zope.interface import providedBy
-from zope.testing.doctestunit import DocTestSuite
from lazr.lifecycle.snapshot import Snapshot
@@ -16,7 +16,7 @@
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.searchbuilder import all, any
from canonical.testing import (
- DatabaseFunctionalLayer, LaunchpadFunctionalLayer, LaunchpadZopelessLayer)
+ DatabaseFunctionalLayer, LaunchpadZopelessLayer)
from lp.bugs.interfaces.bugtarget import IBugTarget
from lp.bugs.interfaces.bugtask import (
=== modified file 'lib/lp/bugs/tests/test_bugtask_0.py'
--- lib/lp/bugs/tests/test_bugtask_0.py 2009-06-25 00:40:31 +0000
+++ lib/lp/bugs/tests/test_bugtask_0.py 2010-07-14 14:34:44 +0000
@@ -5,8 +5,8 @@
__metaclass__ = type
-from zope.testing.doctest import DocTestSuite
-from zope.testing.doctest import REPORT_NDIFF, NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite
+from doctest import REPORT_NDIFF, NORMALIZE_WHITESPACE, ELLIPSIS
def test_open_and_resolved_statuses(self):
=== modified file 'lib/lp/bugs/tests/test_bugtracker.py'
--- lib/lp/bugs/tests/test_bugtracker.py 2010-04-12 09:51:59 +0000
+++ lib/lp/bugs/tests/test_bugtracker.py 2010-07-14 14:34:44 +0000
@@ -3,6 +3,9 @@
__metaclass__ = type
+from doctest import NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import DocTestSuite
+
import unittest
from urllib2 import HTTPError, Request
@@ -13,8 +16,6 @@
import transaction
from zope.security.proxy import removeSecurityProxy
-from zope.testing.doctest import NORMALIZE_WHITESPACE, ELLIPSIS
-from zope.testing.doctestunit import DocTestSuite
from lazr.lifecycle.snapshot import Snapshot
=== modified file 'lib/lp/registry/tests/test_doc_project.py'
--- lib/lp/registry/tests/test_doc_project.py 2010-04-19 09:39:29 +0000
+++ lib/lp/registry/tests/test_doc_project.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,8 @@
__metaclass__ = type
-from zope.testing.doctestunit import DocTestSuite
+from doctest import DocTestSuite
+
from zope.component import getUtility
from canonical.launchpad.ftests import login, ANONYMOUS
from canonical.testing.layers import LaunchpadFunctionalLayer
=== modified file 'lib/lp/scripts/utilities/importfascist.py'
--- lib/lp/scripts/utilities/importfascist.py 2010-02-27 10:32:13 +0000
+++ lib/lp/scripts/utilities/importfascist.py 2010-07-14 14:34:44 +0000
@@ -21,7 +21,6 @@
return set(line.strip() for line in text.splitlines() if line.strip())
-# zope.testing.doctest: called as part of creating a DocTestSuite.
permitted_database_imports = text_lines_to_set("""
canonical.archivepublisher.deathrow
canonical.archivepublisher.domination
@@ -38,7 +37,6 @@
lp.registry.vocabularies
canonical.librarian.client
canonical.librarian.db
- zope.testing.doctest
""")
=== modified file 'lib/lp/services/mail/tests/test_sendmail.py'
--- lib/lp/services/mail/tests/test_sendmail.py 2009-07-17 18:46:25 +0000
+++ lib/lp/services/mail/tests/test_sendmail.py 2010-07-14 14:34:44 +0000
@@ -3,11 +3,10 @@
__metaclass__ = type
+from doctest import DocTestSuite
from email.Message import Message
import unittest
-from zope.testing.doctest import DocTestSuite
-
from canonical.launchpad.helpers import is_ascii_only
from lp.testing import TestCase
from lp.services.mail import sendmail
=== modified file 'lib/lp/services/testing/__init__.py'
--- lib/lp/services/testing/__init__.py 2010-04-23 20:41:06 +0000
+++ lib/lp/services/testing/__init__.py 2010-07-14 14:34:44 +0000
@@ -16,12 +16,11 @@
'build_test_suite',
]
+import doctest
import logging
import os
import unittest
-from zope.testing import doctest
-
from canonical.launchpad.testing.pages import PageTestSuite
from canonical.launchpad.testing.systemdocs import (
LayeredDocFileSuite, setUp, tearDown)
=== modified file 'lib/lp/soyuz/scripts/tests/test_gina.py'
--- lib/lp/soyuz/scripts/tests/test_gina.py 2009-12-10 13:20:12 +0000
+++ lib/lp/soyuz/scripts/tests/test_gina.py 2010-07-14 14:34:44 +0000
@@ -3,7 +3,7 @@
import unittest
-from zope.testing.doctest import DocTestSuite
+from doctest import DocTestSuite
import lp.soyuz.scripts.gina.handlers
=== modified file 'lib/lp/testing/tests/test_inlinetests.py'
--- lib/lp/testing/tests/test_inlinetests.py 2009-10-23 08:02:11 +0000
+++ lib/lp/testing/tests/test_inlinetests.py 2010-07-14 14:34:44 +0000
@@ -4,8 +4,7 @@
"""Run the doc string tests."""
import doctest
-
-from zope.testing.doctest import NORMALIZE_WHITESPACE, ELLIPSIS
+from doctest import NORMALIZE_WHITESPACE, ELLIPSIS
from canonical.launchpad.testing.systemdocs import LayeredDocFileSuite
from canonical.testing import BaseLayer