From 6470b159003ca521ba9ab547ef8f7c4f5d190b86 Mon Sep 17 00:00:00 2001 From: chaoflow Date: Wed, 12 Nov 2008 15:29:28 +0000 Subject: [PATCH] paula.testing: plontesting on base of paula.pasplugins.tests.plone_base git-svn-id: https://svn.plone.org/svn/collective/paula/trunk@75636 db7f04ef-aaf3-0310-a811-c281ed44c4ad --- .../src/paula/pasplugins/tests/test_doctests.py | 19 ++++++++++---- paula.testing/src/paula/testing/__init__.py | 7 +++++ .../src/paula/testing/plonetesting.py | 30 ++++++++++------------ 3 files changed, 34 insertions(+), 22 deletions(-) rename paula.pasplugins/src/paula/pasplugins/tests/plone_base.py => paula.testing/src/paula/testing/plonetesting.py (61%) diff --git a/paula.pasplugins/src/paula/pasplugins/tests/test_doctests.py b/paula.pasplugins/src/paula/pasplugins/tests/test_doctests.py index be5d9f0..f9b09ad 100644 --- a/paula.pasplugins/src/paula/pasplugins/tests/test_doctests.py +++ b/paula.pasplugins/src/paula/pasplugins/tests/test_doctests.py @@ -12,20 +12,29 @@ import doctest from Testing import ZopeTestCase as ztc -from paula.testing import get_test_suite, test_globs - -from paula.pasplugins.tests import plone_base as base +from paula.testing import get_test_suite +from paula.testing import setup_package +from paula.testing import setupPloneSite +from paula.testing import test_globs +from paula.testing import FunctionalTestCase # XXX: this could be derived from __name__, but then it would not work, # if being called as __main__ (see bottom) - is that needed? # eventually we could then derive it from path?! from config import PACKAGE_NAME +#plone stuff +# The order here is important: We first call the (deferred) function which +# installs the products we need for the Optilux package. Then, we let +# PloneTestCase set up this product on installation. +setup_package(PACKAGE_NAME) +setupPloneSite(products=[PACKAGE_NAME]) + tests = [ # Demonstrate the main content types ztc.ZopeDocFileSuite( - 'integration.txt', package='paula.pasplugins', - test_class=base.PaulaFunctionalTestCase, + 'integration.txt', package=PACKAGE_NAME, + test_class=FunctionalTestCase, globs=test_globs, optionflags= \ doctest.NORMALIZE_WHITESPACE | \ diff --git a/paula.testing/src/paula/testing/__init__.py b/paula.testing/src/paula/testing/__init__.py index 03462b8..da571b7 100644 --- a/paula.testing/src/paula/testing/__init__.py +++ b/paula.testing/src/paula/testing/__init__.py @@ -24,3 +24,10 @@ from paula.testing.testing import get_test_suite from paula.testing.testing import test_globs from paula.testing.testing import SuiteGenerator from paula.testing.testing import setUp, tearDown +from paula.testing.testing import my_import +from paula.testing.plonetesting import setup_package +from paula.testing.plonetesting import setupPloneSite +from paula.testing.plonetesting import PloneTestCase +from paula.testing.plonetesting import FunctionalTestCase +from paula.testing.plonetesting import PanelTestCase +from paula.testing.plonetesting import KSSTestCase diff --git a/paula.pasplugins/src/paula/pasplugins/tests/plone_base.py b/paula.testing/src/paula/testing/plonetesting.py similarity index 61% rename from paula.pasplugins/src/paula/pasplugins/tests/plone_base.py rename to paula.testing/src/paula/testing/plonetesting.py index 2ced7fc..6218335 100644 --- a/paula.pasplugins/src/paula/pasplugins/tests/plone_base.py +++ b/paula.testing/src/paula/testing/plonetesting.py @@ -5,14 +5,16 @@ from Testing import ZopeTestCase as ztc from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import onsetup, PloneSite +from Products.PloneTestCase.PloneTestCase import setupPloneSite from plone.app.controlpanel.tests import ControlPanelTestCase from kss.core.tests.base import KSSLayer, KSSViewTestCase +from paula.testing.testing import my_import + @onsetup -def setup_paula_pasplugins(): - """Set up the additional products required for the Optilux Cinema Content. - +def setup_package(pkg_name): + """ The @onsetup decorator causes the execution of this body to be deferred until the setup of the Plone site testing layer. """ @@ -21,37 +23,31 @@ def setup_paula_pasplugins(): # This includes the other products below as well. fiveconfigure.debug_mode = True - import paula.pasplugins - zcml.load_config('ftesting.zcml', paula.pasplugins) + + mod = my_import(pkg_name) + zcml.load_config('ftesting.zcml', mod) fiveconfigure.debug_mode = False # We need to tell the testing framework that these products # should be available. This can't happen until after we have loaded # the ZCML. - ztc.installPackage('paula.pasplugins') + ztc.installPackage(pkg_name) -# The order here is important: We first call the (deferred) function which -# installs the products we need for the Optilux package. Then, we let -# PloneTestCase set up this product on installation. - -setup_paula_pasplugins() -ptc.setupPloneSite(products=['paula.pasplugins']) - -class PaulaTestCase(ptc.PloneTestCase): +class PloneTestCase(ptc.PloneTestCase): """Base class used for test cases """ -class PaulaFunctionalTestCase(ptc.FunctionalTestCase): +class FunctionalTestCase(ptc.FunctionalTestCase): """Test case class used for functional (doc-)tests """ -class PaulaPanelTestCase(PaulaFunctionalTestCase, ControlPanelTestCase): +class PanelTestCase(FunctionalTestCase, ControlPanelTestCase): """Test case used for the control panel tests, with some convenience methods from plone.app.controlpanel. """ -class PaulaKSSTestCase(PaulaFunctionalTestCase, KSSViewTestCase): +class KSSTestCase(FunctionalTestCase, KSSViewTestCase): """Test case used for KSS tests """ -- 2.11.4.GIT