-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update functional tests to only use zope.app.appsetup instead of zope…
….app.testing
- Loading branch information
1 parent
17428ae
commit 7a866d2
Showing
3 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import unittest | ||
import grokcore.site | ||
|
||
from pkg_resources import resource_listdir | ||
from zope.testing import doctest, renormalizing | ||
from zope.app.appsetup.testlayer import ZODBLayer | ||
|
||
FunctionalLayer = ZODBLayer(grokcore.site) | ||
|
||
|
||
def suiteFromPackage(name): | ||
files = resource_listdir(__name__, name) | ||
suite = unittest.TestSuite() | ||
for filename in files: | ||
if not filename.endswith('.py'): | ||
continue | ||
if filename == '__init__.py': | ||
continue | ||
|
||
dottedname = 'grokcore.site.ftests.%s.%s' % (name, filename[:-3]) | ||
test = doctest.DocTestSuite( | ||
dottedname, | ||
extraglobs=dict(getRootFolder=FunctionalLayer.getRootFolder), | ||
optionflags=(doctest.ELLIPSIS+ | ||
doctest.NORMALIZE_WHITESPACE+ | ||
doctest.REPORT_NDIFF) | ||
) | ||
test.layer = FunctionalLayer | ||
|
||
suite.addTest(test) | ||
return suite | ||
|
||
def test_suite(): | ||
suite = unittest.TestSuite() | ||
for name in ['utility', 'site']: | ||
suite.addTest(suiteFromPackage(name)) | ||
return suite | ||
|
||
if __name__ == '__main__': | ||
unittest.main(defaultTest='test_suite') |