From 8a2e6416082c555551bbb0af30ba788acebbd12e Mon Sep 17 00:00:00 2001 From: Sylvain Viollon Date: Tue, 12 Jan 2016 17:44:33 +0100 Subject: [PATCH] Update test setup. --- .../catalog/ftests/test_grok_functional.py | 8 ++---- src/grokcore/catalog/tests/test_grok.py | 28 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/grokcore/catalog/ftests/test_grok_functional.py b/src/grokcore/catalog/ftests/test_grok_functional.py index 9d8bbc5..8c1b362 100644 --- a/src/grokcore/catalog/ftests/test_grok_functional.py +++ b/src/grokcore/catalog/ftests/test_grok_functional.py @@ -1,11 +1,9 @@ -# -*- coding: utf-8 -*- - +import doctest import unittest -import grokcore.catalog - from pkg_resources import resource_listdir -from zope.testing import doctest + from zope.app.appsetup.testlayer import ZODBLayer +import grokcore.catalog FunctionalLayer = ZODBLayer(grokcore.catalog) diff --git a/src/grokcore/catalog/tests/test_grok.py b/src/grokcore/catalog/tests/test_grok.py index a7721a8..58339dd 100644 --- a/src/grokcore/catalog/tests/test_grok.py +++ b/src/grokcore/catalog/tests/test_grok.py @@ -1,11 +1,10 @@ -# -*- coding: utf-8 -*- - +import doctest import re import unittest -import zope.component.eventtesting - from pkg_resources import resource_listdir -from zope.testing import doctest, cleanup, renormalizing + +from zope.testing import cleanup, renormalizing +import zope.component.eventtesting def setUpZope(test): @@ -20,9 +19,9 @@ def cleanUpZope(test): # str(Exception) has changed from Python 2.4 to 2.5 (due to # Exception now being a new-style class). This changes the way # exceptions appear in traceback printouts. - (re.compile(r"ConfigurationExecutionError: :"), - r'ConfigurationExecutionError: \1:'), - ]) + (re.compile( + r"ConfigurationExecutionError: :"), + r'ConfigurationExecutionError: \1:')]) def suiteFromPackage(name): @@ -37,16 +36,17 @@ def suiteFromPackage(name): continue dottedname = 'grokcore.catalog.tests.%s.%s' % (name, filename[:-3]) - test = doctest.DocTestSuite(dottedname, - setUp=setUpZope, - tearDown=cleanUpZope, - checker=checker, - optionflags=doctest.ELLIPSIS+ - doctest.NORMALIZE_WHITESPACE) + test = doctest.DocTestSuite( + dottedname, + setUp=setUpZope, + tearDown=cleanUpZope, + checker=checker, + optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE) suite.addTest(test) return suite + def test_suite(): suite = unittest.TestSuite() for name in ['catalog']: