Beispiel #1
0
    def zodb_setup(self, layer_dotted_name=None):
        if layer_dotted_name:
            self.set_zope_layer(layer_dotted_name)

        from zope.testrunner.runner import order_by_bases
        layers = order_by_bases([self.zope_layer])
        for layer in layers:
            if hasattr(layer, 'testSetUp'):
                if HAS_VERBOSE_CONSOLE:
                    print(WAIT("Test set up {0}.{1}".format(
                        layer.__module__, layer.__name__)))
                layer.testSetUp()
        if HAS_VERBOSE_CONSOLE:
            print(READY("Test set up"))
Beispiel #2
0
    def zodb_teardown(self, layer_dotted_name=None):
        if layer_dotted_name:
            self.set_zope_layer(layer_dotted_name)

        from zope.testrunner.runner import order_by_bases
        layers = order_by_bases([self.zope_layer])
        layers.reverse()
        for layer in layers:
            if hasattr(layer, 'testTearDown'):
                if HAS_VERBOSE_CONSOLE:
                    print(WAIT("Test tear down {0}.{1}".format(
                        layer.__module__, layer.__name__)))
                layer.testTearDown()
        if HAS_VERBOSE_CONSOLE:
            print(READY("Test torn down"))
Beispiel #3
0
def tear_down(setup_layers=setup_layers):
    from zope.testrunner.runner import order_by_bases
    # Tear down any layers not needed for these tests. The unneeded layers
    # might interfere.
    unneeded = [l for l in setup_layers]
    unneeded = order_by_bases(unneeded)
    unneeded.reverse()
    for l in unneeded:
        try:
            try:
                if hasattr(l, 'tearDown'):
                    if HAS_VERBOSE_CONSOLE:
                        print(WAIT("Tear down {0}.{1}".format(l.__module__,
                                                              l.__name__)))
                    l.tearDown()
            except NotImplementedError:
                pass
        finally:
            del setup_layers[l]
Beispiel #4
0
 def order(self, *layers):
     return ', '.join(layer.__name__
                      for layer in runner.order_by_bases(layers))
 def order(self, *layers):
     return ', '.join(l.__name__ for l in runner.order_by_bases(layers))