[Checkins]
SVN: z3c.testsetup/branches/ulif-sepfunctesting/src/z3c/testsetup/functional/doctesting.py
Remove non-ftest code.
Uli Fouquet
uli at gnufix.de
Tue Jun 24 18:40:06 EDT 2008
Log message for revision 87723:
Remove non-ftest code.
Changed:
U z3c.testsetup/branches/ulif-sepfunctesting/src/z3c/testsetup/functional/doctesting.py
-=-
Modified: z3c.testsetup/branches/ulif-sepfunctesting/src/z3c/testsetup/functional/doctesting.py
===================================================================
--- z3c.testsetup/branches/ulif-sepfunctesting/src/z3c/testsetup/functional/doctesting.py 2008-06-24 22:33:16 UTC (rev 87722)
+++ z3c.testsetup/branches/ulif-sepfunctesting/src/z3c/testsetup/functional/doctesting.py 2008-06-24 22:40:05 UTC (rev 87723)
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Test setup helpers for doctests.
+"""Test setup helpers for functional doctests.
"""
import unittest
import os.path
@@ -19,86 +19,9 @@
from zope.app.testing.functional import (
HTTPCaller, getRootFolder, sync, ZCMLLayer, FunctionalDocFileSuite,
FunctionalTestSetup)
-from z3c.testsetup.base import BasicTestSetup
+from z3c.testsetup.doctesting import DocTestSetup
from z3c.testsetup.util import get_package
-class DocTestSetup(BasicTestSetup):
- """A test setup for doctests."""
-
- globs = {}
-
- optionflags = (doctest.ELLIPSIS+
- doctest.NORMALIZE_WHITESPACE+
- doctest.REPORT_NDIFF)
-
- encoding = 'utf-8'
-
- def __init__(self, package, setup=None, teardown=None, globs=None,
- optionflags=None, encoding=None, **kw):
- BasicTestSetup.__init__(self, package, **kw)
- self.setUp = setup or self.setUp
- self.tearDown = teardown or self.tearDown
- self.encoding = encoding or self.encoding
- if globs is not None:
- self.globs = globs
- if optionflags is not None:
- self.optionflags = optionflags
-
-
-class UnitDocTestSetup(DocTestSetup):
- """A unit test setup for packages.
-
- A collection of methods to search for appropriate doctest files in
- a given package. ``UnitTestSetup`` is also able to 'register' the
- tests found and to deliver them as a ready-to-use
- ``unittest.TestSuite`` instance.
-
- While the functionality to search for testfiles is mostly
- inherited from the base class, the focus here is to setup the
- tests correctly.
-
- See file `unittestsetup.py` in the tests/testsetup directory to
- learn more about ``UnitTestSetup``.
- """
-
- optionflags = (doctest.ELLIPSIS+
- doctest.NORMALIZE_WHITESPACE+
- doctest.REPORT_NDIFF)
-
- regexp_list = [
- '^\s*:(T|t)est-(L|l)ayer:\s*(unit)\s*',
- ]
-
- globs = dict()
-
- def setUp(self, test):
- pass
-
- def tearDown(self, test):
- cleanup.cleanUp()
-
- def getTestSuite(self):
- docfiles = self.getDocTestFiles(package=self.package)
- suite = unittest.TestSuite()
- for name in docfiles:
- if os.path.isabs(name):
- # We get absolute pathnames, but we need relative ones...
- common_prefix = os.path.commonprefix([self.package.__file__,
- name])
- name = name[len(common_prefix):]
- suite.addTest(
- doctest.DocFileSuite(
- name,
- package=self.package,
- setUp=self.setUp,
- tearDown=self.tearDown,
- globs=self.globs,
- optionflags=self.optionflags,
- **self.additional_options
- ))
- return suite
-
-
class FunctionalDocTestSetup(DocTestSetup):
"""A functional test setup for packages.
More information about the Checkins
mailing list