Skip to content

Commit

Permalink
Update functional tests to only use zope.app.appsetup instead of zope…
Browse files Browse the repository at this point in the history
….app.testing
  • Loading branch information
thefunny42 committed Apr 14, 2010
1 parent 17428ae commit 7a866d2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Changes
1.3 (unreleased)
----------------

- Nothing changed yet.

- Update functional tests to only use zope.app.appsetup instead
of zope.app.testing.

1.2 (2009-12-20)
----------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def read(*rnames):
)

tests_require = [
'zope.app.testing',
'zope.app.appsetup',
'zope.app.zcmlfiles',
'zope.component',
'zope.configuration',
Expand Down
40 changes: 40 additions & 0 deletions src/grokcore/site/ftests/test_grok_functional.py
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')

0 comments on commit 7a866d2

Please sign in to comment.