Log message for revision 65934: Renamed test_registerpackage to test_pythonproducts.
Changed: _U Products.Five/branches/1.4/ A Products.Five/branches/1.4/tests/test_pythonproducts.py D Products.Five/branches/1.4/tests/test_registerpackage.py -=- Property changes on: Products.Five/branches/1.4 ___________________________________________________________________ Name: svk:merge - 98c0701e-2f07-0410-a1a0-c1bc72243522:/local/Products.Five/branches/1.4:8742 + 98c0701e-2f07-0410-a1a0-c1bc72243522:/local/Products.Five/branches/1.4:8749 Added: Products.Five/branches/1.4/tests/test_pythonproducts.py =================================================================== --- Products.Five/branches/1.4/tests/test_pythonproducts.py 2006-03-12 21:46:58 UTC (rev 65933) +++ Products.Five/branches/1.4/tests/test_pythonproducts.py 2006-03-12 23:20:01 UTC (rev 65934) @@ -0,0 +1,87 @@ +############################################################################## +# +# Copyright (c) 2004, 2005 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Unit tests for the registerPackage directive. + +$Id$ +""" +import os, sys +if __name__ == '__main__': + execfile(os.path.join(sys.path[0], 'framework.py')) + +def test_registerPackage(): + """ + Testing registerPackage + + >>> from zope.app.testing.placelesssetup import setUp, tearDown + >>> setUp() + >>> import Products + >>> import Products.Five + >>> from Products.Five import zcml + >>> from Products.Five import pythonproducts + >>> zcml.load_config('meta.zcml', Products.Five) + >>> pythonproducts.setupPythonProducts(app) + + Make sure a python package with no initialize (even though one + is specified) will fail:: + + >>> configure_zcml = ''' + ... <configure + ... xmlns="http://namespaces.zope.org/zope" + ... xmlns:five="http://namespaces.zope.org/five" + ... i18n_domain="foo"> + ... <five:registerPackage + ... package="Products.Five.tests.testing.pythonproduct1" + ... initialize="Products.Five.tests.testing.pythonproduct1.initialize" + ... /> + ... </configure>''' + >>> zcml.load_string(configure_zcml) + Traceback (most recent call last): + ... + ZopeXMLConfigurationError: ... + ConfigurationError: ('...pythonproduct1 has no global initialize') + + Make sure a python package with a valid initialize gets its + initialize function called:: + + >>> configure_zcml = ''' + ... <configure + ... xmlns="http://namespaces.zope.org/zope" + ... xmlns:five="http://namespaces.zope.org/five" + ... i18n_domain="foo"> + ... <five:registerPackage + ... package="Products.Five.tests.testing.pythonproduct2" + ... initialize="Products.Five.tests.testing.pythonproduct2.initialize" + ... /> + ... </configure>''' + >>> zcml.load_string(configure_zcml) + pythonproduct2 initialized + + Test to see if the pythonproduct2 python package actually gets setup + as a zope2 product in the Control Panel. + + >>> productListing = app.Control_Panel.Products.objectIds() + >>> 'Products.Five.tests.testing.pythonproduct2' in productListing + True + + Clean up: + + >>> tearDown() + """ + +def test_suite(): + from Testing.ZopeTestCase import ZopeDocTestSuite + return ZopeDocTestSuite() + +if __name__ == '__main__': + framework() Deleted: Products.Five/branches/1.4/tests/test_registerpackage.py =================================================================== --- Products.Five/branches/1.4/tests/test_registerpackage.py 2006-03-12 21:46:58 UTC (rev 65933) +++ Products.Five/branches/1.4/tests/test_registerpackage.py 2006-03-12 23:20:01 UTC (rev 65934) @@ -1,87 +0,0 @@ -############################################################################## -# -# Copyright (c) 2004, 2005 Zope Corporation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -"""Unit tests for the registerPackage directive. - -$Id$ -""" -import os, sys -if __name__ == '__main__': - execfile(os.path.join(sys.path[0], 'framework.py')) - -def test_registerPackage(): - """ - Testing registerPackage - - >>> from zope.app.testing.placelesssetup import setUp, tearDown - >>> setUp() - >>> import Products - >>> import Products.Five - >>> from Products.Five import zcml - >>> from Products.Five import pythonproducts - >>> zcml.load_config('meta.zcml', Products.Five) - >>> pythonproducts.setupPythonProducts(app) - - Make sure a python package with no initialize (even though one - is specified) will fail:: - - >>> configure_zcml = ''' - ... <configure - ... xmlns="http://namespaces.zope.org/zope" - ... xmlns:five="http://namespaces.zope.org/five" - ... i18n_domain="foo"> - ... <five:registerPackage - ... package="Products.Five.tests.testing.pythonproduct1" - ... initialize="Products.Five.tests.testing.pythonproduct1.initialize" - ... /> - ... </configure>''' - >>> zcml.load_string(configure_zcml) - Traceback (most recent call last): - ... - ZopeXMLConfigurationError: ... - ConfigurationError: ('...pythonproduct1 has no global initialize') - - Make sure a python package with a valid initialize gets its - initialize function called:: - - >>> configure_zcml = ''' - ... <configure - ... xmlns="http://namespaces.zope.org/zope" - ... xmlns:five="http://namespaces.zope.org/five" - ... i18n_domain="foo"> - ... <five:registerPackage - ... package="Products.Five.tests.testing.pythonproduct2" - ... initialize="Products.Five.tests.testing.pythonproduct2.initialize" - ... /> - ... </configure>''' - >>> zcml.load_string(configure_zcml) - pythonproduct2 initialized - - Test to see if the pythonproduct2 python package actually gets setup - as a zope2 product in the Control Panel. - - >>> productListing = app.Control_Panel.Products.objectIds() - >>> 'Products.Five.tests.testing.pythonproduct2' in productListing - True - - Clean up: - - >>> tearDown() - """ - -def test_suite(): - from Testing.ZopeTestCase import ZopeDocTestSuite - return ZopeDocTestSuite() - -if __name__ == '__main__': - framework() _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins