Merge lp:~jml/launchpad/real-doctest into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Māris Fogels
Approved revision: no longer in the source branch.
Merged at revision: 11147
Proposed branch: lp:~jml/launchpad/real-doctest
Merge into: lp:launchpad
Diff against target: 965 lines (+78/-203)
49 files modified
buildout-templates/bin/test.in (+16/-0)
lib/canonical/buildd/tests/test_harness.py (+1/-1)
lib/canonical/config/tests/test_config.py (+1/-1)
lib/canonical/database/ftests/test_postgresql.py (+2/-1)
lib/canonical/database/tests/test_sqlbase.py (+1/-1)
lib/canonical/launchpad/database/message.py (+0/-1)
lib/canonical/launchpad/database/tests/test_message.py (+1/-1)
lib/canonical/launchpad/mail/ftests/test_stub.py (+2/-1)
lib/canonical/launchpad/mail/tests/test_commands.py (+1/-1)
lib/canonical/launchpad/mail/tests/test_handlers.py (+1/-1)
lib/canonical/launchpad/mail/tests/test_helpers.py (+1/-1)
lib/canonical/launchpad/mail/tests/test_incoming.py (+1/-1)
lib/canonical/launchpad/mailman/config/tests/test_config.py (+1/-1)
lib/canonical/launchpad/scripts/tests/test_rundoctests.py (+1/-2)
lib/canonical/launchpad/testing/pages.py (+1/-3)
lib/canonical/launchpad/testing/systemdocs.py (+4/-5)
lib/canonical/launchpad/testing/tests/test_googleharness.py (+1/-1)
lib/canonical/launchpad/testing/tests/test_systemdocs.py (+1/-2)
lib/canonical/launchpad/tests/test_datetimeutils.py (+1/-1)
lib/canonical/launchpad/tests/test_helpers.py (+1/-1)
lib/canonical/launchpad/tests/test_rundoctests.py (+1/-1)
lib/canonical/launchpad/webapp/ftests/test_vhosts.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test___init__.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_batching.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_notifications.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_publisher.py (+2/-1)
lib/canonical/launchpad/webapp/tests/test_servers.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_sorting.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_tales.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_url.py (+1/-1)
lib/canonical/librarian/ftests/test_harness.py (+1/-1)
lib/canonical/lp/ftests/test_zopeless.py (+2/-1)
lib/canonical/testing/tests/test_doctestcodec.py (+1/-2)
lib/canonical/testing/tests/test_mockdb.py (+2/-140)
lib/canonical/tests/test_base.py (+1/-1)
lib/canonical/tests/test_cachedproperty.py (+2/-1)
lib/canonical/tests/test_encoding.py (+2/-1)
lib/canonical/zeca/ftests/test_harness.py (+1/-1)
lib/lp/app/browser/tests/test_stringformatter.py (+1/-1)
lib/lp/bugs/browser/tests/test_bugtask.py (+1/-1)
lib/lp/bugs/tests/test_bugtask.py (+2/-2)
lib/lp/bugs/tests/test_bugtask_0.py (+2/-2)
lib/lp/bugs/tests/test_bugtracker.py (+3/-2)
lib/lp/registry/tests/test_doc_project.py (+2/-1)
lib/lp/scripts/utilities/importfascist.py (+1/-2)
lib/lp/services/mail/tests/test_sendmail.py (+1/-2)
lib/lp/services/testing/__init__.py (+1/-2)
lib/lp/soyuz/scripts/tests/test_gina.py (+1/-1)
lib/lp/testing/tests/test_inlinetests.py (+1/-2)
To merge this branch: bzr merge lp:~jml/launchpad/real-doctest
Reviewer Review Type Date Requested Status
Māris Fogels (community) code Approve
Review via email: mp+29877@code.launchpad.net

Commit message

Use standard doctest rather than zope.testing.doctest.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Māris Fogels (mars) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'buildout-templates/bin/test.in'
2--- buildout-templates/bin/test.in 2010-05-15 17:43:59 +0000
3+++ buildout-templates/bin/test.in 2010-07-16 17:01:04 +0000
4@@ -26,6 +26,22 @@
5 sys.path.insert(0, ${scripts:parts-directory|path-repr})
6 import site
7
8+
9+# Fix doctest so that it can handle mixed unicode and encoded output.
10+import doctest
11+
12+_RealSpoofOut = doctest._SpoofOut
13+
14+class _SpoofOut(doctest._SpoofOut):
15+
16+ def write(self, value):
17+ if isinstance(value, unicode):
18+ value = value.encode('utf8')
19+ _RealSpoofOut.write(self, value)
20+
21+doctest._SpoofOut = _SpoofOut
22+
23+
24 BUILD_DIR = ${buildout:directory|path-repr}
25 CUSTOM_SITE_DIR = ${scripts:parts-directory|path-repr}
26
27
28=== modified file 'lib/canonical/buildd/tests/test_harness.py'
29--- lib/canonical/buildd/tests/test_harness.py 2009-06-25 05:30:52 +0000
30+++ lib/canonical/buildd/tests/test_harness.py 2010-07-16 17:01:04 +0000
31@@ -3,7 +3,7 @@
32
33 __metaclass__ = type
34
35-from zope.testing import doctest
36+import doctest
37
38 def test_suite():
39 return doctest.DocTestSuite('canonical.buildd.tests.harness')
40
41=== modified file 'lib/canonical/config/tests/test_config.py'
42--- lib/canonical/config/tests/test_config.py 2009-08-05 18:52:52 +0000
43+++ lib/canonical/config/tests/test_config.py 2010-07-16 17:01:04 +0000
44@@ -10,11 +10,11 @@
45 __metaclass__ = type
46
47 import ZConfig
48+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
49 import os
50 import pkg_resources
51 import unittest
52
53-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
54 from lazr.config import ConfigSchema
55 from lazr.config.interfaces import ConfigErrors
56
57
58=== modified file 'lib/canonical/database/ftests/test_postgresql.py'
59--- lib/canonical/database/ftests/test_postgresql.py 2009-06-25 05:30:52 +0000
60+++ lib/canonical/database/ftests/test_postgresql.py 2010-07-16 17:01:04 +0000
61@@ -3,8 +3,9 @@
62
63 __metaclass__ = type
64
65+from doctest import DocTestSuite
66+
67 from canonical.ftests.pgsql import PgTestSetup
68-from zope.testing.doctest import DocTestSuite
69
70 def setUp(test):
71
72
73=== modified file 'lib/canonical/database/tests/test_sqlbase.py'
74--- lib/canonical/database/tests/test_sqlbase.py 2009-06-25 05:30:52 +0000
75+++ lib/canonical/database/tests/test_sqlbase.py 2010-07-16 17:01:04 +0000
76@@ -4,7 +4,7 @@
77 from canonical.database import sqlbase
78 import unittest, doctest
79
80-from zope.testing.doctest import ELLIPSIS, NORMALIZE_WHITESPACE, REPORT_NDIFF
81+from doctest import ELLIPSIS, NORMALIZE_WHITESPACE, REPORT_NDIFF
82
83
84 def test_suite():
85
86=== modified file 'lib/canonical/launchpad/database/message.py'
87--- lib/canonical/launchpad/database/message.py 2009-07-17 00:26:05 +0000
88+++ lib/canonical/launchpad/database/message.py 2010-07-16 17:01:04 +0000
89@@ -706,7 +706,6 @@
90 """
91 # Count the number of messages from the sender since the throttle
92 # date.
93- store = Store.of(self.sender)
94 messages_sent = self._getThrottlers(after).count()
95 return messages_sent < config.launchpad.user_to_user_max_messages
96
97
98=== modified file 'lib/canonical/launchpad/database/tests/test_message.py'
99--- lib/canonical/launchpad/database/tests/test_message.py 2009-06-25 05:30:52 +0000
100+++ lib/canonical/launchpad/database/tests/test_message.py 2010-07-16 17:01:04 +0000
101@@ -4,6 +4,7 @@
102 __metaclass__ = type
103
104 from cStringIO import StringIO
105+from doctest import DocTestSuite
106 from email.Message import Message
107 from email.MIMEText import MIMEText
108 from email.MIMEMultipart import MIMEMultipart
109@@ -13,7 +14,6 @@
110
111 from canonical.testing import LaunchpadFunctionalLayer
112 from sqlobject import SQLObjectNotFound
113-from zope.testing.doctestunit import DocTestSuite
114 from zope.component import getUtility
115
116 from canonical.launchpad.database import (
117
118=== modified file 'lib/canonical/launchpad/mail/ftests/test_stub.py'
119--- lib/canonical/launchpad/mail/ftests/test_stub.py 2009-06-25 05:30:52 +0000
120+++ lib/canonical/launchpad/mail/ftests/test_stub.py 2010-07-16 17:01:04 +0000
121@@ -3,9 +3,10 @@
122
123 __metaclass__ = type
124
125+from doctest import DocTestSuite
126 import unittest
127 import re
128-from zope.testing.doctest import DocTestSuite
129+
130 from zope.testing.renormalizing import RENormalizing
131
132 from canonical.testing import LaunchpadFunctionalLayer
133
134=== modified file 'lib/canonical/launchpad/mail/tests/test_commands.py'
135--- lib/canonical/launchpad/mail/tests/test_commands.py 2009-06-25 05:30:52 +0000
136+++ lib/canonical/launchpad/mail/tests/test_commands.py 2010-07-16 17:01:04 +0000
137@@ -3,7 +3,7 @@
138
139 import unittest
140
141-from zope.testing.doctest import DocTestSuite
142+from doctest import DocTestSuite
143
144
145 def test_suite():
146
147=== modified file 'lib/canonical/launchpad/mail/tests/test_handlers.py'
148--- lib/canonical/launchpad/mail/tests/test_handlers.py 2009-06-25 05:30:52 +0000
149+++ lib/canonical/launchpad/mail/tests/test_handlers.py 2010-07-16 17:01:04 +0000
150@@ -5,7 +5,7 @@
151
152 import unittest
153
154-from zope.testing.doctest import DocTestSuite
155+from doctest import DocTestSuite
156
157 from canonical.launchpad.mail.commands import BugEmailCommand
158 from canonical.launchpad.mail.handlers import MaloneHandler
159
160=== modified file 'lib/canonical/launchpad/mail/tests/test_helpers.py'
161--- lib/canonical/launchpad/mail/tests/test_helpers.py 2009-06-25 05:30:52 +0000
162+++ lib/canonical/launchpad/mail/tests/test_helpers.py 2010-07-16 17:01:04 +0000
163@@ -3,10 +3,10 @@
164
165 __metaclass__ = type
166
167+from doctest import DocTestSuite
168 import unittest
169
170 from zope.interface import directlyProvides, directlyProvidedBy
171-from zope.testing.doctest import DocTestSuite
172
173 from canonical.launchpad.interfaces.mail import (
174 EmailProcessingError, IWeaklyAuthenticatedPrincipal)
175
176=== modified file 'lib/canonical/launchpad/mail/tests/test_incoming.py'
177--- lib/canonical/launchpad/mail/tests/test_incoming.py 2010-06-01 01:14:42 +0000
178+++ lib/canonical/launchpad/mail/tests/test_incoming.py 2010-07-16 17:01:04 +0000
179@@ -1,11 +1,11 @@
180 # Copyright 2009 Canonical Ltd. This software is licensed under the
181 # GNU Affero General Public License version 3 (see the file LICENSE).
182
183+from doctest import DocTestSuite
184 import os
185 import unittest
186
187 import transaction
188-from zope.testing.doctest import DocTestSuite
189
190 from canonical.launchpad.mail.ftests.helpers import testmails_path
191 from canonical.launchpad.mail.incoming import handleMail, MailErrorUtility
192
193=== modified file 'lib/canonical/launchpad/mailman/config/tests/test_config.py'
194--- lib/canonical/launchpad/mailman/config/tests/test_config.py 2009-06-25 05:30:52 +0000
195+++ lib/canonical/launchpad/mailman/config/tests/test_config.py 2010-07-16 17:01:04 +0000
196@@ -1,7 +1,7 @@
197 # Copyright 2009 Canonical Ltd. This software is licensed under the
198 # GNU Affero General Public License version 3 (see the file LICENSE).
199
200-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
201+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
202
203 def test_suite():
204 suite = DocTestSuite(
205
206=== modified file 'lib/canonical/launchpad/scripts/tests/test_rundoctests.py'
207--- lib/canonical/launchpad/scripts/tests/test_rundoctests.py 2010-03-07 00:31:23 +0000
208+++ lib/canonical/launchpad/scripts/tests/test_rundoctests.py 2010-07-16 17:01:04 +0000
209@@ -3,10 +3,9 @@
210
211 __metaclass__ = type
212
213+from doctest import DocTestSuite
214 import unittest
215
216-from zope.testing.doctestunit import DocTestSuite
217-
218 from canonical.testing import reset_logging
219
220 def tearDown(test):
221
222=== modified file 'lib/canonical/launchpad/testing/pages.py'
223--- lib/canonical/launchpad/testing/pages.py 2010-06-14 18:14:28 +0000
224+++ lib/canonical/launchpad/testing/pages.py 2010-07-16 17:01:04 +0000
225@@ -9,6 +9,7 @@
226
227 __metaclass__ = type
228
229+import doctest
230 import os
231 import pdb
232 import pprint
233@@ -26,11 +27,8 @@
234 from zope.app.testing.functional import HTTPCaller, SimpleCookie
235 from zope.component import getUtility
236 from zope.testbrowser.testing import Browser
237-from zope.testing import doctest
238 from zope.security.proxy import removeSecurityProxy
239
240-from launchpadlib.launchpad import Launchpad
241-
242 from canonical.launchpad.interfaces import (
243 IOAuthConsumerSet, OAUTH_REALM, ILaunchpadCelebrities,
244 TeamMembershipStatus)
245
246=== modified file 'lib/canonical/launchpad/testing/systemdocs.py'
247--- lib/canonical/launchpad/testing/systemdocs.py 2010-04-23 20:41:06 +0000
248+++ lib/canonical/launchpad/testing/systemdocs.py 2010-07-16 17:01:04 +0000
249@@ -17,6 +17,7 @@
250 'tearDown',
251 ]
252
253+import doctest
254 import logging
255 import os
256 import pdb
257@@ -25,7 +26,6 @@
258
259 import transaction
260 from zope.component import getUtility
261-from zope.testing import doctest
262 from zope.testing.loggingsupport import Handler
263
264 from canonical.chunkydiff import elided_source
265@@ -60,12 +60,11 @@
266
267 class FilePrefixStrippingDocTestParser(doctest.DocTestParser):
268 """A DocTestParser that strips a prefix from doctests."""
269- def get_doctest(self, string, globs, name, filename, lineno,
270- optionflags=0):
271+
272+ def get_doctest(self, string, globs, name, filename, lineno):
273 filename = strip_prefix(filename)
274 return doctest.DocTestParser.get_doctest(
275- self, string, globs, name, filename, lineno,
276- optionflags=optionflags)
277+ self, string, globs, name, filename, lineno)
278
279
280 default_parser = FilePrefixStrippingDocTestParser()
281
282=== modified file 'lib/canonical/launchpad/testing/tests/test_googleharness.py'
283--- lib/canonical/launchpad/testing/tests/test_googleharness.py 2009-06-25 05:30:52 +0000
284+++ lib/canonical/launchpad/testing/tests/test_googleharness.py 2010-07-16 17:01:04 +0000
285@@ -1,7 +1,7 @@
286 # Copyright 2009 Canonical Ltd. This software is licensed under the
287 # GNU Affero General Public License version 3 (see the file LICENSE).
288
289-from zope.testing import doctest
290+import doctest
291
292 def test_suite():
293 return doctest.DocTestSuite(
294
295=== modified file 'lib/canonical/launchpad/testing/tests/test_systemdocs.py'
296--- lib/canonical/launchpad/testing/tests/test_systemdocs.py 2009-06-25 05:30:52 +0000
297+++ lib/canonical/launchpad/testing/tests/test_systemdocs.py 2010-07-16 17:01:04 +0000
298@@ -5,14 +5,13 @@
299
300 __metaclass__ = type
301
302+import doctest
303 import logging
304 import os
305 import shutil
306 import tempfile
307 import unittest
308
309-from zope.testing import doctest
310-
311 from canonical.config import config
312 from canonical.launchpad.testing.systemdocs import (
313 default_optionflags, LayeredDocFileSuite)
314
315=== modified file 'lib/canonical/launchpad/tests/test_datetimeutils.py'
316--- lib/canonical/launchpad/tests/test_datetimeutils.py 2009-06-25 05:30:52 +0000
317+++ lib/canonical/launchpad/tests/test_datetimeutils.py 2010-07-16 17:01:04 +0000
318@@ -3,7 +3,7 @@
319
320 import unittest
321
322-from zope.testing.doctest import DocTestSuite
323+from doctest import DocTestSuite
324
325 from canonical.launchpad import datetimeutils
326
327
328=== modified file 'lib/canonical/launchpad/tests/test_helpers.py'
329--- lib/canonical/launchpad/tests/test_helpers.py 2010-04-26 16:00:31 +0000
330+++ lib/canonical/launchpad/tests/test_helpers.py 2010-07-16 17:01:04 +0000
331@@ -1,10 +1,10 @@
332 # Copyright 2009 Canonical Ltd. This software is licensed under the
333 # GNU Affero General Public License version 3 (see the file LICENSE).
334
335+from doctest import DocTestSuite
336 import unittest
337
338 from canonical.testing import LaunchpadFunctionalLayer
339-from zope.testing.doctest import DocTestSuite
340 from zope.publisher.interfaces.browser import IBrowserRequest
341 from zope.interface import implements
342
343
344=== modified file 'lib/canonical/launchpad/tests/test_rundoctests.py'
345--- lib/canonical/launchpad/tests/test_rundoctests.py 2009-06-25 05:30:52 +0000
346+++ lib/canonical/launchpad/tests/test_rundoctests.py 2010-07-16 17:01:04 +0000
347@@ -3,7 +3,7 @@
348
349 __metaclass__ = type
350
351-from zope.testing.doctestunit import DocTestSuite
352+from doctest import DocTestSuite
353
354 def test_suite():
355 return DocTestSuite('canonical.launchpad.helpers')
356
357=== modified file 'lib/canonical/launchpad/webapp/ftests/test_vhosts.py'
358--- lib/canonical/launchpad/webapp/ftests/test_vhosts.py 2009-06-25 05:30:52 +0000
359+++ lib/canonical/launchpad/webapp/ftests/test_vhosts.py 2010-07-16 17:01:04 +0000
360@@ -5,7 +5,7 @@
361
362 __metaclass__ = type
363
364-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
365+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
366
367 def test_suite():
368 suite = DocTestSuite(
369
370=== modified file 'lib/canonical/launchpad/webapp/tests/test___init__.py'
371--- lib/canonical/launchpad/webapp/tests/test___init__.py 2009-06-25 05:30:52 +0000
372+++ lib/canonical/launchpad/webapp/tests/test___init__.py 2010-07-16 17:01:04 +0000
373@@ -3,7 +3,7 @@
374
375 __metaclass__ = type
376
377-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
378+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
379
380 def test_suite():
381 suite = DocTestSuite(
382
383=== modified file 'lib/canonical/launchpad/webapp/tests/test_batching.py'
384--- lib/canonical/launchpad/webapp/tests/test_batching.py 2009-06-25 05:30:52 +0000
385+++ lib/canonical/launchpad/webapp/tests/test_batching.py 2010-07-16 17:01:04 +0000
386@@ -3,7 +3,7 @@
387
388 __metaclass__ = type
389
390-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
391+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
392
393 def test_suite():
394 suite = DocTestSuite(
395
396=== modified file 'lib/canonical/launchpad/webapp/tests/test_notifications.py'
397--- lib/canonical/launchpad/webapp/tests/test_notifications.py 2009-10-21 20:47:13 +0000
398+++ lib/canonical/launchpad/webapp/tests/test_notifications.py 2010-07-16 17:01:04 +0000
399@@ -5,9 +5,9 @@
400
401 __metaclass__ = type
402
403+from doctest import DocTestSuite
404 import unittest
405
406-from zope.testing.doctest import DocTestSuite
407 from zope.interface import implements
408 from zope.session.interfaces import ISession, ISessionData
409 from zope.app.testing import ztapi, placelesssetup
410
411=== modified file 'lib/canonical/launchpad/webapp/tests/test_publisher.py'
412--- lib/canonical/launchpad/webapp/tests/test_publisher.py 2009-06-25 05:30:52 +0000
413+++ lib/canonical/launchpad/webapp/tests/test_publisher.py 2010-07-16 17:01:04 +0000
414@@ -1,8 +1,9 @@
415 # Copyright 2009 Canonical Ltd. This software is licensed under the
416 # GNU Affero General Public License version 3 (see the file LICENSE).
417
418+from doctest import DocTestSuite, ELLIPSIS
419 import unittest
420-from zope.testing.doctest import DocTestSuite, ELLIPSIS
421+
422 from canonical.launchpad.webapp import publisher
423
424 def test_suite():
425
426=== modified file 'lib/canonical/launchpad/webapp/tests/test_servers.py'
427--- lib/canonical/launchpad/webapp/tests/test_servers.py 2010-04-27 15:56:20 +0000
428+++ lib/canonical/launchpad/webapp/tests/test_servers.py 2010-07-16 17:01:04 +0000
429@@ -5,11 +5,11 @@
430
431 __metaclass__ = type
432
433+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
434 import StringIO
435 import unittest
436
437 from zope.component import getGlobalSiteManager, getUtility
438-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
439 from zope.interface import implements, Interface
440
441 from lazr.restful.interfaces import (
442
443=== modified file 'lib/canonical/launchpad/webapp/tests/test_sorting.py'
444--- lib/canonical/launchpad/webapp/tests/test_sorting.py 2009-06-25 05:30:52 +0000
445+++ lib/canonical/launchpad/webapp/tests/test_sorting.py 2010-07-16 17:01:04 +0000
446@@ -3,7 +3,7 @@
447
448 __metaclass__ = type
449
450-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
451+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
452
453 def test_suite():
454 suite = DocTestSuite(
455
456=== modified file 'lib/canonical/launchpad/webapp/tests/test_tales.py'
457--- lib/canonical/launchpad/webapp/tests/test_tales.py 2010-06-14 04:23:37 +0000
458+++ lib/canonical/launchpad/webapp/tests/test_tales.py 2010-07-16 17:01:04 +0000
459@@ -5,7 +5,7 @@
460
461 import unittest
462
463-from zope.testing.doctestunit import DocTestSuite
464+from doctest import DocTestSuite
465
466
467 def test_requestapi():
468
469=== modified file 'lib/canonical/launchpad/webapp/tests/test_url.py'
470--- lib/canonical/launchpad/webapp/tests/test_url.py 2009-06-25 05:30:52 +0000
471+++ lib/canonical/launchpad/webapp/tests/test_url.py 2010-07-16 17:01:04 +0000
472@@ -3,7 +3,7 @@
473
474 __metaclass__ = type
475
476-from zope.testing.doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
477+from doctest import DocTestSuite, NORMALIZE_WHITESPACE, ELLIPSIS
478
479 def test_suite():
480 suite = DocTestSuite(
481
482=== modified file 'lib/canonical/librarian/ftests/test_harness.py'
483--- lib/canonical/librarian/ftests/test_harness.py 2009-06-25 05:30:52 +0000
484+++ lib/canonical/librarian/ftests/test_harness.py 2010-07-16 17:01:04 +0000
485@@ -3,7 +3,7 @@
486
487 __metaclass__ = type
488
489-from zope.testing import doctest
490+import doctest
491
492 def test_suite():
493 return doctest.DocTestSuite(
494
495=== modified file 'lib/canonical/lp/ftests/test_zopeless.py'
496--- lib/canonical/lp/ftests/test_zopeless.py 2010-04-15 00:36:22 +0000
497+++ lib/canonical/lp/ftests/test_zopeless.py 2010-07-16 17:01:04 +0000
498@@ -4,13 +4,14 @@
499 """
500 Tests to make sure that initZopeless works as expected.
501 """
502+
503+from doctest import DocTestSuite
504 from threading import Thread
505 import unittest
506 import warnings
507
508 import psycopg2
509 from sqlobject import StringCol, IntCol
510-from zope.testing.doctest import DocTestSuite
511
512 from canonical.database.sqlbase import SQLBase, alreadyInstalledMsg, cursor
513 from canonical.ftests.pgsql import PgTestSetup
514
515=== modified file 'lib/canonical/testing/tests/test_doctestcodec.py'
516--- lib/canonical/testing/tests/test_doctestcodec.py 2009-07-17 02:25:09 +0000
517+++ lib/canonical/testing/tests/test_doctestcodec.py 2010-07-16 17:01:04 +0000
518@@ -6,10 +6,9 @@
519 __metaclass__ = type
520 __all__ = []
521
522+from doctest import DocTestSuite
523 import unittest
524
525-from zope.testing.doctestunit import DocTestSuite
526-
527 import canonical.testing.doctestcodec
528
529 def test_suite():
530
531=== modified file 'lib/canonical/testing/tests/test_mockdb.py'
532--- lib/canonical/testing/tests/test_mockdb.py 2009-08-05 18:52:52 +0000
533+++ lib/canonical/testing/tests/test_mockdb.py 2010-07-16 17:01:04 +0000
534@@ -6,17 +6,16 @@
535 __metaclass__ = type
536 __all__ = []
537
538+from doctest import DocTestSuite
539 import os
540 import os.path
541 import unittest
542
543-from zope.testing.doctestunit import DocTestSuite
544-#from zope.testing.testrunner import dont_retry, RetryTest
545-
546 from canonical.testing import mockdb
547
548
549 class MockDbTestCase(unittest.TestCase):
550+
551 def setUp(self):
552 self.script_filename = mockdb.script_filename('_mockdb_unittest')
553
554@@ -24,7 +23,6 @@
555 if os.path.exists(self.script_filename):
556 os.unlink(self.script_filename)
557
558- #@dont_retry
559 def testSerialize(self):
560 # Ensure the scripts can store and retrieve their logs
561 recorder = mockdb.ScriptRecorder(self.script_filename)
562@@ -34,29 +32,6 @@
563 replayer = mockdb.ScriptPlayer(self.script_filename)
564 self.failUnlessEqual(replayer.log, ['Arbitrary Data'])
565
566- #@dont_retry
567- #def testHandleInvalidScript(self):
568- # Ensure a RetryTest exception is raised and the invalid script
569- # file removed when handleInvalidScript() is called
570- # recorder = mockdb.ScriptRecorder(self.script_filename)
571- # recorder.store()
572-
573- # replayer = mockdb.ScriptPlayer(self.script_filename)
574-
575- # self.assertRaises(
576- # RetryTest, replayer.handleInvalidScript, 'Reason')
577- # self.failIf(os.path.exists(self.script_filename))
578-
579- #@dont_retry
580- #def testShortScript(self):
581- # Ensure a RetryTest exception is raised if an attempt is made
582- # to pull results from an exhausted script.
583- # recorder = mockdb.ScriptRecorder(self.script_filename)
584- # recorder.store()
585- # replayer = mockdb.ScriptPlayer(self.script_filename)
586- # self.assertRaises(RetryTest, replayer.getNextEntry, None, None)
587-
588- #@dont_retry
589 def testScriptFilename(self):
590 # Ensure evil characters in the key don't mess up the script_filename
591 # results. Only '/' is really evil - other chars should all work
592@@ -83,122 +58,9 @@
593
594 _retry_count = 0
595
596- # This test does not use @dont_retry.
597- # It needs to leak RetryTest exeptions as it tests that the
598- # test runner is handling them correctly.
599- #def testRetryTestRetriesTest(self):
600- # The first time this test is run it raises a RetryTest exception.
601- # The second time it is run it succeeds. This means that this
602- # test will fail if RetryTest handling is not being done correctly
603- # (as the test will have raised an exception), and succeed if
604- # RetryTest handling is working (because it succeeds on retry).
605- # This test should really be upstream in zope.testing but
606- # is here so Launchpad can confirm that the correctly patched
607- # version of zope.testing is in use and to minimize the zope.testing
608- # patch until we decide if RetryTest handling is to be pushed
609- # upstream or not.
610- # MockDbTestCase._retry_count += 1
611- # if MockDbTestCase._retry_count % 2 == 1:
612- # raise RetryTest(
613- # "Testing RetryTest behavior. This exception will be raised "
614- # "but the test runner doesn't consider it a failure")
615-
616
617 _doctest_retry_count = 0
618
619-#def retry_on_odd_numbered_calls():
620-# """Helper for doctest RetryTest test.
621-
622-# This helper raises a RetryTest exception on odd numbered calls,
623-# and prints 'Retry not raised' on even numbered calls.
624-
625-# >>> try:
626-# ... retry_on_odd_numbered_calls()
627-# ... except RetryTest:
628-# ... print "Caught RetryTest."
629-# ...
630-# Retry raised.
631-# Caught RetryTest.
632-# >>> try:
633-# ... retry_on_odd_numbered_calls()
634-# ... except RetryTest:
635-# ... print "Caught RetryTest."
636-# ...
637-# Retry not raised.
638-# """
639-# global _doctest_retry_count
640-# _doctest_retry_count += 1
641-# if _doctest_retry_count % 2 == 1:
642-# print "Retry raised."
643-# raise RetryTest
644-# print "Retry not raised."
645-
646-
647-#def testRetryTestInDoctest_will_raise_but_testrunner_ignores_it():
648-# """Test a RetryTest exception in a doctest works as expected.
649-
650-# This doctest raises a RetryTest exception the first time it is run.
651-# On the second run, it succeeds.
652-
653-# If the testrunner is correctly handling RetryTest exceptions raised
654-# by doctests, then the RetryTest exception will not be reported as
655-# a failure. This test will then be rerun and succeed.
656-
657-# If the testrunner is not correctly handling RetryTest exceptions,
658-# then the RetryTesst exception will be flagged as an error.
659-
660-# This test confirms that a RetryException raised where no exception
661-# was expected works.
662-
663-# >>> retry_on_odd_numbered_calls()
664-# Retry not raised.
665-# """
666-
667-
668-#def retry_on_odd_numbered_calls2():
669-# """Helper for doctest RetryTest test.
670-
671-# This helper raises a RetryTest exception on odd numbered calls,
672-# and a RuntimeError on even numbered calls.
673-
674-# >>> try:
675-# ... retry_on_odd_numbered_calls2()
676-# ... except RetryTest:
677-# ... print "Caught RetryTest."
678-# ...
679-# Retry raised.
680-# Caught RetryTest.
681-# >>> try:
682-# ... retry_on_odd_numbered_calls2()
683-# ... except RetryTest:
684-# ... print "Caught RetryTest."
685-# ...
686-# Traceback (most recent call last):
687-# ...
688-# RuntimeError: Retry not raised.
689-# """
690-# global _doctest_retry_count
691-# _doctest_retry_count += 1
692-# if _doctest_retry_count % 2 == 1:
693-# print "Retry raised."
694-# raise RetryTest
695-# raise RuntimeError("Retry not raised.")
696-
697-
698-#def testRetryTestInDoctest2():
699-# """Test a RetryTest exception in a doctest works as expected.
700-
701-# This test is the same as testRetryTestInDoctest, except it confirms
702-# that a RetryException raised where a different exception was expected
703-# works.
704-
705-# >>> retry_on_odd_numbered_calls2()
706-# Traceback (most recent call last):
707-# ...
708-# RuntimeError: Retry not raised.
709-# """
710-
711-
712
713 def test_suite():
714 suite = unittest.TestSuite()
715
716=== modified file 'lib/canonical/tests/test_base.py'
717--- lib/canonical/tests/test_base.py 2009-06-25 05:30:52 +0000
718+++ lib/canonical/tests/test_base.py 2010-07-16 17:01:04 +0000
719@@ -1,8 +1,8 @@
720 # Copyright 2009 Canonical Ltd. This software is licensed under the
721 # GNU Affero General Public License version 3 (see the file LICENSE).
722
723+from doctest import DocTestSuite
724 import unittest
725-from zope.testing.doctestunit import DocTestSuite
726 import canonical.base
727
728 def test_suite():
729
730=== modified file 'lib/canonical/tests/test_cachedproperty.py'
731--- lib/canonical/tests/test_cachedproperty.py 2009-06-25 05:30:52 +0000
732+++ lib/canonical/tests/test_cachedproperty.py 2010-07-16 17:01:04 +0000
733@@ -1,8 +1,9 @@
734 # Copyright 2009 Canonical Ltd. This software is licensed under the
735 # GNU Affero General Public License version 3 (see the file LICENSE).
736
737+from doctest import DocTestSuite, ELLIPSIS
738 import unittest
739-from zope.testing.doctest import DocTestSuite, ELLIPSIS
740+
741 import canonical.cachedproperty
742
743 def test_suite():
744
745=== modified file 'lib/canonical/tests/test_encoding.py'
746--- lib/canonical/tests/test_encoding.py 2009-06-25 05:30:52 +0000
747+++ lib/canonical/tests/test_encoding.py 2010-07-16 17:01:04 +0000
748@@ -1,8 +1,9 @@
749 # Copyright 2009 Canonical Ltd. This software is licensed under the
750 # GNU Affero General Public License version 3 (see the file LICENSE).
751
752+from doctest import DocTestSuite, ELLIPSIS
753 import unittest
754-from zope.testing.doctest import DocTestSuite, ELLIPSIS
755+
756 import canonical.encoding
757
758 def test_suite():
759
760=== modified file 'lib/canonical/zeca/ftests/test_harness.py'
761--- lib/canonical/zeca/ftests/test_harness.py 2009-06-25 05:30:52 +0000
762+++ lib/canonical/zeca/ftests/test_harness.py 2010-07-16 17:01:04 +0000
763@@ -3,7 +3,7 @@
764
765 __metaclass__ = type
766
767-from zope.testing import doctest
768+import doctest
769
770 from canonical.launchpad.testing.systemdocs import default_optionflags
771
772
773=== modified file 'lib/lp/app/browser/tests/test_stringformatter.py'
774--- lib/lp/app/browser/tests/test_stringformatter.py 2010-06-14 04:23:37 +0000
775+++ lib/lp/app/browser/tests/test_stringformatter.py 2010-07-16 17:01:04 +0000
776@@ -5,11 +5,11 @@
777
778 __metaclass__ = type
779
780+from doctest import DocTestSuite
781 from textwrap import dedent
782 import unittest
783
784 from zope.component import getUtility
785-from zope.testing.doctestunit import DocTestSuite
786
787 from canonical.config import config
788 from canonical.launchpad.testing.pages import find_tags_by_class
789
790=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
791--- lib/lp/bugs/browser/tests/test_bugtask.py 2010-06-05 10:41:52 +0000
792+++ lib/lp/bugs/browser/tests/test_bugtask.py 2010-07-16 17:01:04 +0000
793@@ -4,10 +4,10 @@
794 __metaclass__ = type
795
796
797+from doctest import DocTestSuite
798 import unittest
799
800 from zope.security.proxy import removeSecurityProxy
801-from zope.testing.doctest import DocTestSuite
802
803 from canonical.launchpad.ftests import ANONYMOUS, login, login_person
804 from canonical.launchpad.testing.systemdocs import (
805
806=== modified file 'lib/lp/bugs/tests/test_bugtask.py'
807--- lib/lp/bugs/tests/test_bugtask.py 2010-06-24 17:09:14 +0000
808+++ lib/lp/bugs/tests/test_bugtask.py 2010-07-16 17:01:04 +0000
809@@ -4,11 +4,11 @@
810 __metaclass__ = type
811
812 from datetime import timedelta
813+from doctest import DocTestSuite
814 import unittest
815
816 from zope.component import getUtility
817 from zope.interface import providedBy
818-from zope.testing.doctestunit import DocTestSuite
819
820 from lazr.lifecycle.snapshot import Snapshot
821
822@@ -16,7 +16,7 @@
823 from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
824 from canonical.launchpad.searchbuilder import all, any
825 from canonical.testing import (
826- DatabaseFunctionalLayer, LaunchpadFunctionalLayer, LaunchpadZopelessLayer)
827+ DatabaseFunctionalLayer, LaunchpadZopelessLayer)
828
829 from lp.bugs.interfaces.bugtarget import IBugTarget
830 from lp.bugs.interfaces.bugtask import (
831
832=== modified file 'lib/lp/bugs/tests/test_bugtask_0.py'
833--- lib/lp/bugs/tests/test_bugtask_0.py 2009-06-25 00:40:31 +0000
834+++ lib/lp/bugs/tests/test_bugtask_0.py 2010-07-16 17:01:04 +0000
835@@ -5,8 +5,8 @@
836
837 __metaclass__ = type
838
839-from zope.testing.doctest import DocTestSuite
840-from zope.testing.doctest import REPORT_NDIFF, NORMALIZE_WHITESPACE, ELLIPSIS
841+from doctest import DocTestSuite
842+from doctest import REPORT_NDIFF, NORMALIZE_WHITESPACE, ELLIPSIS
843
844
845 def test_open_and_resolved_statuses(self):
846
847=== modified file 'lib/lp/bugs/tests/test_bugtracker.py'
848--- lib/lp/bugs/tests/test_bugtracker.py 2010-04-12 09:51:59 +0000
849+++ lib/lp/bugs/tests/test_bugtracker.py 2010-07-16 17:01:04 +0000
850@@ -3,6 +3,9 @@
851
852 __metaclass__ = type
853
854+from doctest import NORMALIZE_WHITESPACE, ELLIPSIS
855+from doctest import DocTestSuite
856+
857 import unittest
858 from urllib2 import HTTPError, Request
859
860@@ -13,8 +16,6 @@
861 import transaction
862
863 from zope.security.proxy import removeSecurityProxy
864-from zope.testing.doctest import NORMALIZE_WHITESPACE, ELLIPSIS
865-from zope.testing.doctestunit import DocTestSuite
866
867 from lazr.lifecycle.snapshot import Snapshot
868
869
870=== modified file 'lib/lp/registry/tests/test_doc_project.py'
871--- lib/lp/registry/tests/test_doc_project.py 2010-04-19 09:39:29 +0000
872+++ lib/lp/registry/tests/test_doc_project.py 2010-07-16 17:01:04 +0000
873@@ -3,7 +3,8 @@
874
875 __metaclass__ = type
876
877-from zope.testing.doctestunit import DocTestSuite
878+from doctest import DocTestSuite
879+
880 from zope.component import getUtility
881 from canonical.launchpad.ftests import login, ANONYMOUS
882 from canonical.testing.layers import LaunchpadFunctionalLayer
883
884=== modified file 'lib/lp/scripts/utilities/importfascist.py'
885--- lib/lp/scripts/utilities/importfascist.py 2010-02-27 10:32:13 +0000
886+++ lib/lp/scripts/utilities/importfascist.py 2010-07-16 17:01:04 +0000
887@@ -21,7 +21,6 @@
888 return set(line.strip() for line in text.splitlines() if line.strip())
889
890
891-# zope.testing.doctest: called as part of creating a DocTestSuite.
892 permitted_database_imports = text_lines_to_set("""
893 canonical.archivepublisher.deathrow
894 canonical.archivepublisher.domination
895@@ -38,7 +37,7 @@
896 lp.registry.vocabularies
897 canonical.librarian.client
898 canonical.librarian.db
899- zope.testing.doctest
900+ doctest
901 """)
902
903
904
905=== modified file 'lib/lp/services/mail/tests/test_sendmail.py'
906--- lib/lp/services/mail/tests/test_sendmail.py 2009-07-17 18:46:25 +0000
907+++ lib/lp/services/mail/tests/test_sendmail.py 2010-07-16 17:01:04 +0000
908@@ -3,11 +3,10 @@
909
910 __metaclass__ = type
911
912+from doctest import DocTestSuite
913 from email.Message import Message
914 import unittest
915
916-from zope.testing.doctest import DocTestSuite
917-
918 from canonical.launchpad.helpers import is_ascii_only
919 from lp.testing import TestCase
920 from lp.services.mail import sendmail
921
922=== modified file 'lib/lp/services/testing/__init__.py'
923--- lib/lp/services/testing/__init__.py 2010-04-23 20:41:06 +0000
924+++ lib/lp/services/testing/__init__.py 2010-07-16 17:01:04 +0000
925@@ -16,12 +16,11 @@
926 'build_test_suite',
927 ]
928
929+import doctest
930 import logging
931 import os
932 import unittest
933
934-from zope.testing import doctest
935-
936 from canonical.launchpad.testing.pages import PageTestSuite
937 from canonical.launchpad.testing.systemdocs import (
938 LayeredDocFileSuite, setUp, tearDown)
939
940=== modified file 'lib/lp/soyuz/scripts/tests/test_gina.py'
941--- lib/lp/soyuz/scripts/tests/test_gina.py 2009-12-10 13:20:12 +0000
942+++ lib/lp/soyuz/scripts/tests/test_gina.py 2010-07-16 17:01:04 +0000
943@@ -3,7 +3,7 @@
944
945 import unittest
946
947-from zope.testing.doctest import DocTestSuite
948+from doctest import DocTestSuite
949
950 import lp.soyuz.scripts.gina.handlers
951
952
953=== modified file 'lib/lp/testing/tests/test_inlinetests.py'
954--- lib/lp/testing/tests/test_inlinetests.py 2009-10-23 08:02:11 +0000
955+++ lib/lp/testing/tests/test_inlinetests.py 2010-07-16 17:01:04 +0000
956@@ -4,8 +4,7 @@
957 """Run the doc string tests."""
958
959 import doctest
960-
961-from zope.testing.doctest import NORMALIZE_WHITESPACE, ELLIPSIS
962+from doctest import NORMALIZE_WHITESPACE, ELLIPSIS
963
964 from canonical.launchpad.testing.systemdocs import LayeredDocFileSuite
965 from canonical.testing import BaseLayer