l.t.l.BaseLayer : class documentation

Part of lp.testing.layers View In Hierarchy

Known subclasses: lp.codehosting.codeimport.tests.test_worker.ForeignBranchPluginLayer, lp.testing.layers.BingServiceLayer, lp.testing.layers.DatabaseLayer, lp.testing.layers.FunctionalLayer, lp.testing.layers.MemcachedLayer, lp.testing.layers.RabbitMQLayer, lp.testing.layers.TwistedLayer, lp.testing.layers.ZopelessLayer

Base layer.

All our layers should subclass Base, as this is where we will put test isolation checks to ensure that tests to not leave global resources in a mess.

XXX: StuartBishop 2006-07-12: Unit tests (tests with no layer) will not get these checks. The Z3 test runner should be updated so that a layer can be specified to use for unit tests.

Class Method make_config Create a temporary config and link it into the layer cleanup.
Class Method setUp Undocumented
Class Method tearDown Undocumented
Class Method testSetUp Undocumented
Class Method testTearDown Undocumented
Class Method check Check that the environment is working as expected.
Class Method flagTestIsolationFailure Handle a breakdown in test isolation.
Class Method getCurrentTestResult Return the TestResult currently in play.
Class Method getCurrentTestCase Return the test currently in play.
Class Method appserver_config Return a config suitable for AppServer tests.
Class Method appserver_root_url Return the correct app server root url for the given facet.
@classmethod
def make_config(cls, config_name, clone_from, attr_name):
Create a temporary config and link it into the layer cleanup.
@classmethod
@profiled
def setUp(cls):
Undocumented
@classmethod
@profiled
def tearDown(cls):
Undocumented
@classmethod
@profiled
def testSetUp(cls):
Undocumented
@classmethod
@profiled
def testTearDown(cls):
Undocumented
@classmethod
@profiled
def check(cls):
Check that the environment is working as expected.

We check here so we can detect tests that, for example, initialize the Zopeless or Functional environments and are using the incorrect layer.

@classmethod
def flagTestIsolationFailure(cls, message):
Handle a breakdown in test isolation.

If the test that broke isolation thinks it succeeded, add an error. If the test failed, don't add a notification as the isolation breakdown is probably just fallout.

The layer that detected the isolation failure still needs to repair the damage, or in the worst case abort the test run.

@classmethod
def getCurrentTestResult(cls):
Return the TestResult currently in play.
@classmethod
def getCurrentTestCase(cls):
Return the test currently in play.
@classmethod
def appserver_config(cls):
Return a config suitable for AppServer tests.
@classmethod
def appserver_root_url(cls, facet='mainsite', ensureSlash=False):
Return the correct app server root url for the given facet.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.