Hi,

I am refactoring some tests in Products.eXtremeManagement and related
packages and am wondering how much test setup I can get rid of.

To make it more general: I am wondering how much of the test setup in
ZopeSkel packages is really needed.  I am thinking of e.g. the
following lines from the plone template:


---------------------------------------
class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            fiveconfigure.debug_mode = True
            zcml.load_config('configure.zcml',
                             ${namespace_package}.${package})
            fiveconfigure.debug_mode = False

        @classmethod
        def tearDown(cls):
            pass
---------------------------------------

or as a variant, pasted from an eXtremeManagement test:

---------------------------------------
@onsetup
def xm_setup():
    """Set up our Plone Site.
    """
    fiveconfigure.debug_mode = True
    import xm.booking
    zcml.load_config('configure.zcml', xm.booking)
    fiveconfigure.debug_mode = False

xm_setup()
ptc.setupPloneSite(products=['Products.eXtremeManagement'])
---------------------------------------


Are those lines with loading zcml config really needed?  I mean: with
buildout you just put your package in [buildout]eggs and if needed in
[instance]zcml and it just works.  You run 'bin/instance test -s
my.package" and everything gets picked up.  If a normal "bin/instance
fg" (or start) would have a problem (e.g. missing zcml) then it is not
really helpful if "bin/instance test ..." does a few extra things,
effectively hiding the error that you would have gotten on normal
startup.

Is it perhaps needed to support non-buildout environments?


Also, some templates (the ones that define portlets) have:

  ztc.installPackage('my.package').

That line is only needed when the package has an installer or a
GenericSetup profile, right?  

I can imagine that the lines for loading the zcml *are* needed there
because then you can ensure that the zcml gets loaded before calling
installPackage.  Is this perhaps the only good reason for including
those zcml lines in that specific case only?


Testingly yours,

-- 
Maurits van Rees | http://maurits.vanrees.org/
            Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to