The oslo_context.fixture Module

class oslo_context.fixture.ClearRequestContext

Bases: fixtures.fixture.Fixture

Clears any cached RequestContext

This resets RequestContext at the beginning and end of tests that use this fixture to ensure that we have a clean slate for running tests, and that we leave a clean slate for other tests that might run later in the same process.

setUp() None

Prepare the Fixture for use.

This should not be overridden. Concrete fixtures should implement _setUp. Overriding of setUp is still supported, just not recommended.

After setUp has completed, the fixture will have one or more attributes which can be used (these depend totally on the concrete subclass).

Raises

MultipleExceptions if _setUp fails. The last exception captured within the MultipleExceptions will be a SetupError exception.

Returns

None.

Changed in 1.3

The recommendation to override setUp has been reversed - before 1.3, setUp() should be overridden, now it should not be.

Changed in 1.3.1

BaseException is now caught, and only subclasses of Exception are wrapped in MultipleExceptions.