[Checkins] SVN: zope.security/trunk/ Ensure cleanups for doctests even when run w/o 'test_suite'.

Tres Seaver cvs-admin at zope.org
Sun Dec 23 20:53:59 UTC 2012


Log message for revision 128859:
  Ensure cleanups for doctests even when run w/o 'test_suite'.

Changed:
  _U  zope.security/trunk/
  U   zope.security/trunk/src/zope/security/permission.py

-=-
Modified: zope.security/trunk/src/zope/security/permission.py
===================================================================
--- zope.security/trunk/src/zope/security/permission.py	2012-12-22 01:26:46 UTC (rev 128858)
+++ zope.security/trunk/src/zope/security/permission.py	2012-12-23 20:53:58 UTC (rev 128859)
@@ -33,6 +33,8 @@
 def checkPermission(context, permission_id):
     """Check whether a given permission exists in the provided context.
 
+    >>> from zope.component.testing import setUp, tearDown
+    >>> setUp()
     >>> from zope.component import provideUtility
     >>> provideUtility(Permission('x'), IPermission, 'x')
 
@@ -45,6 +47,7 @@
     The CheckerPublic always exists:
     
     >>> checkPermission(None, CheckerPublic)
+    >>> tearDown()
     
     """
     if permission_id is CheckerPublic:
@@ -55,6 +58,8 @@
 def allPermissions(context=None):
     """Get the ids of all defined permissions
 
+    >>> from zope.component.testing import setUp, tearDown
+    >>> setUp()
     >>> from zope.component import provideUtility
     >>> provideUtility(Permission('x'), IPermission, 'x')
     >>> provideUtility(Permission('y'), IPermission, 'y')
@@ -63,6 +68,7 @@
     >>> ids.sort()
     >>> ids
     [u'x', u'y']
+    >>> tearDown()
     """
     for id, permission in getUtilitiesFor(IPermission, context):
         if id != u'zope.Public':
@@ -75,6 +81,8 @@
     
     To illustrate, we need to register the permission IDs vocabulary:
 
+    >>> from zope.component.testing import setUp, tearDown
+    >>> setUp()
     >>> from zope.schema.vocabulary import _clear
     >>> _clear()
 
@@ -99,6 +107,7 @@
     True
     >>> vocab.getTermByToken('b').value is b
     True
+    >>> tearDown()
 
     """
     terms = []
@@ -122,6 +131,8 @@
 
     To illustrate, we need to register the permission IDs vocabulary:
 
+    >>> from zope.component.testing import setUp, tearDown
+    >>> setUp()
     >>> from zope.schema.vocabulary import _clear
     >>> _clear()
 
@@ -165,6 +176,7 @@
 
     >>> [term.title for term in vocab]
     [u'Public', u'a', u'b']
+    >>> tearDown()
     """
 
     terms = []



More information about the checkins mailing list