def tearDown(self): # Zap the stacked ZODB self['zodbDB'].close() del self['zodbDB'] # Zap the stacked zca context zca.popGlobalRegistry()
def tearDown(self): """remove previously added ldifs """ read_env(self) for ldif in self.ldifs: print "Removing ldif %s recursively: " % (ldif, ), with open(ldif) as ldif: dns = [ x.strip().split(' ', 1)[1] for x in ldif if x.startswith('dn: ') ] cmd = [ self.ldapdeletebin, '-x', '-D', self['binddn'], '-c', '-r', '-w', self['bindpw'], '-H', self['uris'] ] + dns retcode = subprocess.call(cmd, stderr=subprocess.PIPE) print "done. %s" % retcode for key in ('ucfg', 'gcfg'): if key in self: del self[key] if not os.environ.get('node.ext.ldap.testldap.skip_zca_hook'): # XXX: fails to pop global registry in Zope 2. Why? try: zca.popGlobalRegistry() print 80 * '*' print "pop global registry" except Exception, e: print 80 * '*' print "pop global registry failed" print e print 80 * '*'
def tearDown(self): """remove previously added ldifs """ read_env(self) for ldif in self.ldifs: print "Removing ldif %s recursively: " % (ldif,), with open(ldif) as ldif: dns = [x.strip().split(' ', 1)[1] for x in ldif if x.startswith('dn: ')] cmd = [self.ldapdeletebin, '-x', '-D', self['binddn'], '-c', '-r', '-w', self['bindpw'], '-H', self['uris']] + dns retcode = subprocess.call(cmd, stderr=subprocess.PIPE) print "done. %s" % retcode for key in ('ucfg', 'gcfg'): if key in self: del self[key] if not os.environ.get('node.ext.ldap.testldap.skip_zca_hook'): # XXX: fails to pop global registry in Zope 2. Why? try: zca.popGlobalRegistry() print 80 * '*' print "pop global registry" except Exception, e: print 80 * '*' print "pop global registry failed" print e print 80 * '*'
def tearDown(self): # Zap the stacked configuration context zca.popGlobalRegistry() del self['configurationContext'] # Zap the stacked ZODB self['zodbDB'].close() del self['zodbDB']
def tearDownZCML(self): """Pop the global component registry stack, effectively unregistering all global components registered during layer setup. """ # Pop the global registry zca.popGlobalRegistry() # Zap the stacked configuration context del self['configurationContext']
def tearDownZCML(self): """Tear down the component registry and delete the ``configurationContext`` resource. """ # Delete the (possibly stacked) configuration context del self['configurationContext'] # Zap all globally loaded ZCML from plone.testing import zca zca.popGlobalRegistry()
def popGlobalRegistry(portal): """Restore the global component registry form the top of the stack, as set with ``pushGlobalRegistry()``. Also ensure that the persistent component registry at ``portal`` has the new global registry as its base. """ # First, check if the component site has the global site manager in its # bases. If so, that site manager is about to disappear, so set its # base(s) as the new base(s) for the local site manager. from zope.component import getGlobalSiteManager globalSiteManager = getGlobalSiteManager() gsmBases = globalSiteManager.__bases__ from zope.site.hooks import setSite, getSite, setHooks site = getSite() localSiteManager = portal.getSiteManager() bases = [] changed = False for base in localSiteManager.__bases__: if base is globalSiteManager: bases.extend(gsmBases) changed = True else: bases.append(base) if changed: localSiteManager.__bases__ = tuple(bases) # Now pop the registry. We need to do it in this somewhat convoluted way # to avoid the risk of unpickling errors previous = zca.popGlobalRegistry() if site is not None: setHooks() setSite(site) return previous
def popGlobalRegistry(silvaroot): """Restore the global component registry form the top of the stack, as set with ``pushGlobalRegistry()``. Also ensure that the persistent component registry at ``silvaroot`` has the new global registry as its base. """ from zope.app.component.hooks import setSite, getSite, setHooks site = getSite() # Now pop the registry. We need to do it in this somewhat convoluted way # to avoid the risk of unpickling errors previous = zca.popGlobalRegistry() if site is not None: setHooks() setSite(site) return previous
def tearDown(self): zca.popGlobalRegistry()
def tearDown(self): zca.popGlobalRegistry() self.configurationContext = None
def tearDown(self): # Zap the stacked zca context zca.popGlobalRegistry()
def tearDown(self): zca.popGlobalRegistry() if hasattr(self, 'configurationContext'): del self['configurationContext'] zope.component.testing.tearDown(self)
def tearDown(self): # remove the stacked storage layer self['zodbDB'].close() del(self['zodbDB']) zca.popGlobalRegistry()
def tearDown(self): zca.popGlobalRegistry() del self['configurationContext']