Commit b427bb74 authored by Jim Fulton's avatar Jim Fulton

Use newer doctest

parent 0abbea6b
......@@ -495,7 +495,7 @@ def test_zsp_gets_right_roles_for_methods():
"""
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
suite = unittest.TestSuite()
......
......@@ -1527,7 +1527,7 @@ def showaq(m_self, indent=''):
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
return unittest.TestSuite((
......
......@@ -66,7 +66,7 @@ def test_wrapper_support():
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
from ExtensionClass import Base
from ComputedAttribute import ComputedAttribute
......
......@@ -737,7 +737,7 @@ def test___of___w_metaclass_instance():
"""
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
import unittest
def test_suite():
......
......@@ -16,7 +16,7 @@
$Id$
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_xxx():
"""
......
......@@ -36,7 +36,7 @@
$Id$
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
return unittest.TestSuite((
......
......@@ -50,7 +50,7 @@
$Id$
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
return unittest.TestSuite((
......
......@@ -16,7 +16,7 @@
$Id$
"""
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
import pickle
from Persistence import Persistent
......
......@@ -16,7 +16,7 @@
$Id$
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
from Persistence import PersistentMapping
def test_basic_functionality():
......
......@@ -39,7 +39,7 @@ def test_RecordPickling():
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
return unittest.TestSuite((
......
......@@ -57,7 +57,7 @@ $Id: tests.py,v 1.2 2003/11/28 16:46:39 jim Exp $
import ThreadLock, threading, time
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
return unittest.TestSuite((
......
......@@ -405,7 +405,7 @@ class Rollback(object):
def test_suite():
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
return DocTestSuite()
if __name__ == '__main__':
......
......@@ -20,7 +20,7 @@ import sys
import unittest
import persistent
import transaction
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
from ZODB.tests.util import DB
def test_integration():
......
......@@ -13,7 +13,7 @@
##############################################################################
"""Unit tests for the Connection class."""
import doctest
from zope.testing import doctest
import unittest
import warnings
......
......@@ -350,7 +350,7 @@ def testTimeTravelOnOpen():
"""
def test_suite():
import doctest
from zope.testing import doctest
suite = unittest.TestSuite()
for klass in [FileStorageTests, Corruption.FileStorageCorruptTests,
......
......@@ -118,7 +118,7 @@ class SerializerTestCase(unittest.TestCase):
def test_suite():
import doctest
from zope.testing import doctest
suite = unittest.makeSuite(SerializerTestCase)
suite.addTest(doctest.DocTestSuite("ZODB.serialize"))
return suite
......@@ -132,7 +132,7 @@ database state as of the last sub-transaction commit. There is
"""
import doctest
from zope.testing import doctest
def test_suite():
return doctest.DocTestSuite()
......@@ -13,7 +13,7 @@
##############################################################################
"""Test behavior of Connection plus cPickleCache."""
import doctest
from zope.testing import doctest
from persistent import Persistent
import transaction
......
......@@ -16,7 +16,7 @@
$Id$
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
from transaction._transaction import DataManagerAdapter
from ZODB.tests.sampledm import DataManager
......
......@@ -358,7 +358,7 @@ clearing the Connection's local transaction.
"""
import doctest
from zope.testing import doctest
def test_suite():
return doctest.DocTestSuite()
......@@ -267,7 +267,7 @@ def testPublisher():
pass
import doctest
from zope.testing import doctest
def test_suite():
return doctest.DocTestSuite()
......@@ -40,7 +40,7 @@ def test_delitem():
"""
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
import unittest
def test_suite():
......
......@@ -398,5 +398,5 @@ class SampleOverridingGetattributeSetattrAndDelattr(Persistent):
def test_suite():
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
return DocTestSuite()
......@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import doctest
from zope.testing import doctest
import os
import sys
import unittest
......@@ -25,30 +25,5 @@ class P(Persistent):
def inc(self):
self.x += 1
try:
DocFileSuite = doctest.DocFileSuite # >= Python 2.4.0a2
except AttributeError:
# <= Python 2.4.0a1
def DocFileSuite(path, globs=None):
# It's not entirely obvious how to connection this single string
# with unittest. For now, re-use the _utest() function that comes
# standard with doctest in Python 2.3. One problem is that the
# error indicator doesn't point to the line of the doctest file
# that failed.
path = os.path.join(persistent.tests.__path__[0], path)
source = open(path).read()
if globs is None:
globs = sys._getframe(1).f_globals
t = doctest.Tester(globs=globs)
def runit():
doctest._utest(t, path, source, path, 0)
f = unittest.FunctionTestCase(runit,
description="doctest from %s" % path)
suite = unittest.TestSuite()
suite.addTest(f)
return suite
def test_suite():
return DocFileSuite("persistent.txt", globs={"P": P})
return doctest.DocFileSuite("persistent.txt", globs={"P": P})
......@@ -276,7 +276,7 @@ def test_pickling_w_slots_w_empty_dict():
"""
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
import unittest
def test_suite():
......
......@@ -16,7 +16,7 @@
$Id$
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
return DocTestSuite('persistent.wref')
......
......@@ -405,7 +405,7 @@ class Rollback(object):
def test_suite():
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
return DocTestSuite()
if __name__ == '__main__':
......
......@@ -148,7 +148,7 @@ class TestConnection:
obj.abort()
self.aborted.append(obj)
import doctest
from zope.testing import doctest
def test_suite():
return doctest.DocTestSuite()
......@@ -636,7 +636,7 @@ def test_join():
"""
def test_suite():
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
return unittest.TestSuite((
DocTestSuite(),
unittest.makeSuite(TransactionTests),
......
......@@ -16,7 +16,7 @@
$Id$
"""
import unittest
from doctest import DocTestSuite
from zope.testing.doctest import DocTestSuite
def test_suite():
return DocTestSuite('transaction.util')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment