[Checkins] SVN: zope.security/trunk/ - Added ``zcml`` extra dependencies, run related tests only if
Thomas Lotze
tl at gocept.com
Sun Sep 19 06:26:38 EDT 2010
Log message for revision 116625:
- Added ``zcml`` extra dependencies, run related tests only if
``zope.configuration`` is available.
- Run tests related to the ``untrustedpython`` functionality only if
``RestrictedPython`` is available.
Changed:
U zope.security/trunk/CHANGES.txt
U zope.security/trunk/buildout.cfg
U zope.security/trunk/setup.py
U zope.security/trunk/src/zope/security/tests/test_contentdirective.py
U zope.security/trunk/src/zope/security/tests/test_directives.py
U zope.security/trunk/src/zope/security/tests/test_module_directives.py
U zope.security/trunk/src/zope/security/untrustedpython/tests.py
-=-
Modified: zope.security/trunk/CHANGES.txt
===================================================================
--- zope.security/trunk/CHANGES.txt 2010-09-19 09:58:24 UTC (rev 116624)
+++ zope.security/trunk/CHANGES.txt 2010-09-19 10:26:38 UTC (rev 116625)
@@ -5,7 +5,12 @@
3.7.4 (unreleased)
------------------
+- Added ``zcml`` extra dependencies, run related tests only if
+ ``zope.configuration`` is available.
+- Run tests related to the ``untrustedpython`` functionality only if
+ ``RestrictedPython`` is available.
+
3.7.3 (2010-04-30)
------------------
Modified: zope.security/trunk/buildout.cfg
===================================================================
--- zope.security/trunk/buildout.cfg 2010-09-19 09:58:24 UTC (rev 116624)
+++ zope.security/trunk/buildout.cfg 2010-09-19 10:26:38 UTC (rev 116625)
@@ -1,15 +1,11 @@
[buildout]
develop = .
-parts = test test_pytz python coverage-test coverage-report
+parts = test python coverage-test coverage-report
[test]
recipe = zc.recipe.testrunner
-eggs = zope.security [test]
+eggs = zope.security [test,untrustedpython,zcml,pytz]
-[test_pytz]
-recipe = zc.recipe.testrunner
-eggs = zope.security [test,pytz]
-
[python]
recipe = zc.recipe.egg
eggs = zope.security [untrustedpython]
Modified: zope.security/trunk/setup.py
===================================================================
--- zope.security/trunk/setup.py 2010-09-19 09:58:24 UTC (rev 116624)
+++ zope.security/trunk/setup.py 2010-09-19 10:26:38 UTC (rev 116625)
@@ -65,7 +65,6 @@
],
install_requires=['setuptools',
'zope.component',
- 'zope.configuration',
'zope.i18nmessageid',
'zope.interface',
'zope.location',
@@ -74,8 +73,9 @@
],
extras_require = dict(
untrustedpython=["RestrictedPython"],
- test=["RestrictedPython"],
+ test=['zope.testing'],
pytz=["pytz"],
+ zcml=['zope.configuration'],
),
include_package_data = True,
zip_safe = False,
Modified: zope.security/trunk/src/zope/security/tests/test_contentdirective.py
===================================================================
--- zope.security/trunk/src/zope/security/tests/test_contentdirective.py 2010-09-19 09:58:24 UTC (rev 116624)
+++ zope.security/trunk/src/zope/security/tests/test_contentdirective.py 2010-09-19 10:26:38 UTC (rev 116625)
@@ -19,7 +19,12 @@
from zope.component.interfaces import IFactory
from zope.component.interfaces import ComponentLookupError
from zope.component.interface import queryInterface
-from zope.configuration.xmlconfig import xmlconfig, XMLConfig
+try:
+ from zope.configuration.xmlconfig import xmlconfig, XMLConfig
+except ImportError:
+ HAVE_ZCML = False
+else:
+ HAVE_ZCML = True
import zope.component
import zope.security
@@ -190,12 +195,11 @@
def test_suite():
+ if not HAVE_ZCML:
+ return unittest.TestSuite()
+
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTest(loader.loadTestsFromTestCase(TestClassDirective))
suite.addTest(loader.loadTestsFromTestCase(TestFactorySubdirective))
return suite
-
-
-if __name__=='__main__':
- unittest.TextTestRunner().run(test_suite())
Modified: zope.security/trunk/src/zope/security/tests/test_directives.py
===================================================================
--- zope.security/trunk/src/zope/security/tests/test_directives.py 2010-09-19 09:58:24 UTC (rev 116624)
+++ zope.security/trunk/src/zope/security/tests/test_directives.py 2010-09-19 10:26:38 UTC (rev 116625)
@@ -23,8 +23,14 @@
from zope.interface import implements
from zope.component.interface import queryInterface
-from zope.configuration.xmlconfig import xmlconfig, XMLConfig
-from zope.configuration.xmlconfig import ZopeXMLConfigurationError
+try:
+ from zope.configuration.xmlconfig import xmlconfig, XMLConfig
+ from zope.configuration.xmlconfig import ZopeXMLConfigurationError
+except ImportError:
+ HAVE_ZCML = False
+else:
+ HAVE_ZCML = True
+
from zope.security.checker import selectChecker
from zope.security import proxy
@@ -366,6 +372,9 @@
def test_suite():
+ if not HAVE_ZCML:
+ return unittest.TestSuite()
+
return unittest.TestSuite((
unittest.makeSuite(TestFactoryDirective),
unittest.makeSuite(TestRequireDirective),
Modified: zope.security/trunk/src/zope/security/tests/test_module_directives.py
===================================================================
--- zope.security/trunk/src/zope/security/tests/test_module_directives.py 2010-09-19 09:58:24 UTC (rev 116624)
+++ zope.security/trunk/src/zope/security/tests/test_module_directives.py 2010-09-19 10:26:38 UTC (rev 116625)
@@ -18,13 +18,15 @@
import unittest
from pprint import PrettyPrinter
-import zope.security.zcml
from zope.interface import Interface, Attribute
from zope.component.testing import setUp, tearDown, PlacelessSetup
-from zope.configuration import xmlconfig
+try:
+ from zope.configuration import xmlconfig
+except ImportError:
+ HAVE_ZCML = False
+else:
+ HAVE_ZCML = True
-from zope.security import metaconfigure
-
def pprint(ob, width=70):
PrettyPrinter(width=width).pprint(ob)
@@ -41,6 +43,8 @@
def test_protectModule():
"""
+ >>> from zope.security import metaconfigure
+
>>> from zope.security.tests import test_directives
>>> from zope.security.interfaces import IPermission
>>> from zope.security.permission import Permission
@@ -81,6 +85,8 @@
The allow directive creates actions for each named defined
directly, or via interface:
+ >>> from zope.security import metaconfigure
+
>>> class Context(object):
... def __init__(self):
... self.actions = []
@@ -139,6 +145,8 @@
The allow directive creates actions for each named defined
directly, or via interface:
+ >>> from zope.security import metaconfigure
+
>>> class Context(object):
... def __init__(self):
... self.actions = []
@@ -191,10 +199,16 @@
"""
-class IDummy(Interface):
- perm = zope.security.zcml.Permission(title=u'')
+if HAVE_ZCML:
+ import zope.security.zcml
+
+ class IDummy(Interface):
+
+ perm = zope.security.zcml.Permission(title=u'')
+
+
perms = []
def dummy(context_, perm):
@@ -228,6 +242,9 @@
setUpAuth()
def test_suite():
+ if not HAVE_ZCML:
+ return unittest.TestSuite()
+
return unittest.TestSuite((
doctest.DocTestSuite(setUp=setUp, tearDown=tearDown),
doctest.DocTestSuite('zope.security.zcml'),
Modified: zope.security/trunk/src/zope/security/untrustedpython/tests.py
===================================================================
--- zope.security/trunk/src/zope/security/untrustedpython/tests.py 2010-09-19 09:58:24 UTC (rev 116624)
+++ zope.security/trunk/src/zope/security/untrustedpython/tests.py 2010-09-19 10:26:38 UTC (rev 116625)
@@ -22,6 +22,11 @@
def test_suite():
+ try:
+ import RestrictedPython
+ except ImportError:
+ return unittest.TestSuite()
+
checker = renormalizing.RENormalizing([
(re.compile(r"'ImmutableModule' object"), r'object'),
])
More information about the checkins
mailing list