def tearDownDebugMode(self): """Return the debug mode flag to its previous state """ from AccessControl.Implementation import setImplementation setImplementation("C") import App.config config = App.config.getConfiguration() config.debug_mode = self._debugMode App.config.setConfiguration(config) del self._debugMode
def setUpDebugMode(self): """Switch off debug mode in the global configuration """ import App.config config = App.config.getConfiguration() self._debugMode = config.debug_mode config.debug_mode = False App.config.setConfiguration(config) # Set Python security mode from AccessControl.Implementation import setImplementation setImplementation("Python") # Set a flag so that other code can know that we are running tests. # Some of the speed-related patches in Plone use this, for instance. # The name is a BBB artefact from ZopeTestCase : import os os.environ['ZOPETESTCASE'] = '1'
def tearDown(self): setImplementation(self.original)