fix resolving Issue 2178

parent 9b8fce0a
......@@ -194,6 +194,14 @@ def http(request_string, handle_errors=True):
return DocResponseWrapper(response, outstream, path, header_output)
def extractLayer(func):
def wrap(*args, **kw):
suite = func(*args, **kw)
tc = kw.get('test_class', None)
if tc and hasattr(tc, 'layer'):
suite.layer = tc.layer
return suite
return wrap
class ZopeSuiteFactory:
......@@ -298,23 +306,23 @@ class FunctionalSuiteFactory(ZopeSuiteFactory):
| doctest.REPORT_NDIFF
| doctest.NORMALIZE_WHITESPACE)
@extractLayer
def ZopeDocTestSuite(module=None, **kw):
module = doctest._normalize_module(module)
return ZopeSuiteFactory(module, **kw).doctestsuite()
@extractLayer
def ZopeDocFileSuite(*paths, **kw):
if kw.get('module_relative', True):
kw['package'] = doctest._normalize_module(kw.get('package'))
return ZopeSuiteFactory(*paths, **kw).docfilesuite()
@extractLayer
def FunctionalDocTestSuite(module=None, **kw):
module = doctest._normalize_module(module)
return FunctionalSuiteFactory(module, **kw).doctestsuite()
@extractLayer
def FunctionalDocFileSuite(*paths, **kw):
if kw.get('module_relative', True):
kw['package'] = doctest._normalize_module(kw.get('package'))
......
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