[ZPT] CVS: Zope/lib/python/Products/PageTemplates/tests - testDTMLTests.py:1.6

Jens Vagelpohl jens@zope.com
Thu, 24 Jan 2002 15:38:28 -0500

Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests
In directory cvs.zope.org:/tmp/cvs-serv28188

Modified Files:
Log Message:
Squashing unit tests failures occurring on Mac OS X.

The changes simply emulate the setup and teardown as done in the other
testing module for PageTemplates, testHTMLTests. I am not 100% sure if the fix 
is the correct thing to do but it makes the tests run on Mac OS X and 
does not affect them on Linux.

The main reason behind the failures is most likely some other test that runs
before which fiddles with the security policies but never cleans up
afterwards. I did some poking but could not find anything.

=== Zope/lib/python/Products/PageTemplates/tests/testDTMLTests.py 1.5 => 1.6 ===
 from Acquisition import Implicit
 from AccessControl import SecurityManager
+from AccessControl.SecurityManagement import noSecurityManager
 class AqPageTemplate(Implicit, PageTemplate):
@@ -48,9 +49,11 @@
       self.policy = UnitTestSecurityPolicy()
       self.oldPolicy = SecurityManager.setSecurityPolicy( self.policy )
+      noSecurityManager()  # Use the new policy.
    def tearDown(self):
       SecurityManager.setSecurityPolicy( self.oldPolicy )
+      noSecurityManager()  # Reset to old policy.
    def check1(self):
       """DTML test 1: if, in, and var: