[Checkins] SVN: z3c.testsetup/branches/ulif-cleanup/src/z3c/testsetup/doctesting.py * Tighten getTestSuite()
Uli Fouquet
uli at gnufix.de
Mon Oct 26 09:18:39 EDT 2009
Log message for revision 105280:
* Tighten getTestSuite()
* Fix logic of ZCML layer handling
* Modify warning message when no zope.app.testing is available.
Changed:
U z3c.testsetup/branches/ulif-cleanup/src/z3c/testsetup/doctesting.py
-=-
Modified: z3c.testsetup/branches/ulif-cleanup/src/z3c/testsetup/doctesting.py
===================================================================
--- z3c.testsetup/branches/ulif-cleanup/src/z3c/testsetup/doctesting.py 2009-10-26 13:14:16 UTC (rev 105279)
+++ z3c.testsetup/branches/ulif-cleanup/src/z3c/testsetup/doctesting.py 2009-10-26 13:18:38 UTC (rev 105280)
@@ -22,6 +22,7 @@
get_attribute)
marker = object()
+error_marker = object()
class DocTestSetup(BasicTestSetup):
"""A test setup for doctests."""
@@ -68,6 +69,8 @@
zcml_layer = self.getZCMLLayer(
name, 'zcml-file')
+ if zcml_layer is error_marker:
+ continue
if zcml_layer is not None:
layerdef = zcml_layer
@@ -91,6 +94,8 @@
try:
from zope.app.testing.functional import (
FunctionalDocFileSuite, ZCMLLayer)
+ if isinstance(layerdef, ZCMLLayer):
+ suite_creator = FunctionalDocFileSuite
except ImportError:
if zcml_layer is not None:
warn("""You specified `:zcml-file:` in
@@ -98,10 +103,8 @@
but there seems to be no `zope.app.testing` package available.
Please include `zope.app.testing` in your project setup to run this testfile.
""" % (os.path.join(common_prefix, name),))
- continue
- if isinstance(layerdef, ZCMLLayer):
- suite_creator = FunctionalDocFileSuite
+
test = self.setupTestfile(
suite_creator, name, self.package, setup, teardown,
self.globs, self.optionflags, self.checker, self.encoding,
@@ -138,16 +141,19 @@
# ``zope.app.testing`` available.
from z3c.testsetup.functional.layer import DefaultZCMLLayer
except ImportError:
- warn("""You specified `%s` in
+ warn("""You specified `:%s:` in
+
%s
+
but there seems to be no `zope.app.testing` package available.
Please include `zope.app.testing` in your project setup to run this testfile.
-""" % (marker, name))
+""" % (marker, filepath))
+ return error_marker
+ zcml_filepath = os.path.join(os.path.dirname(filepath), zcml_file)
layer = DefaultZCMLLayer(
- os.path.join(os.path.dirname(filepath), zcml_file),
+ zcml_filepath,
DefaultZCMLLayer.__module__,
- '%s [%s]' % (DefaultZCMLLayer.__name__,
- os.path.join(os.path.dirname(filepath), zcml_file)),
+ '%s [%s]' % (DefaultZCMLLayer.__name__, zcml_filepath),
allow_teardown=self.allow_teardown)
return layer
More information about the checkins
mailing list