Bases: fixtures.fixture.Fixture
Allows overriding configuration settings for the test.
conf will be reset on cleanup.
Override configuration values.
The keyword arguments are the names of configuration options to override and their values.
If a group argument is supplied, the overrides are applied to the specified configuration option group, otherwise the overrides are applied to the default group.
Register a single option for the test run.
Options registered in this manner will automatically be unregistered during cleanup.
If a group argument is supplied, it will register the new option to that group, otherwise the option is registered to the default group.
Register multiple options for the test run.
This works in the same manner as register_opt() but takes a list of options as the first argument. All arguments will be registered to the same group if the group argument is supplied, otherwise all options will be registered to the default group.
Bases: fixtures.fixture.Fixture
External locking fixture.
This fixture is basically an alternative to the synchronized decorator with the external flag so that tearDowns and addCleanups will be included in the lock context for locking between tests. The fixture is recommended to be the first line in a test method, like so:
def test_method(self):
self.useFixture(LockFixture)
...
or the first line in setUp if all the test methods in the class are required to be serialized. Something like:
class TestCase(testtools.testcase):
def setUp(self):
self.useFixture(LockFixture)
super(TestCase, self).setUp()
...
This is because addCleanups are put on a LIFO queue that gets run after the test method exits. (either by completing or raising an exception)