Testing Configurations

class oslo_messaging.conffixture.ConfFixture(conf, transport_url=None)

Tweak configuration options for unit testing.

oslo.messaging registers a number of configuration options, but rather than directly referencing those options, users of the API should use this interface for querying and overriding certain configuration options.

An example usage:

self.messaging_conf = self.useFixture(messaging.ConfFixture(cfg.CONF))
self.messaging_conf.transport_url = 'fake:/'
  • conf (oslo.config.cfg.ConfigOpts) – a ConfigOpts instance

  • transport_url (str) – override default transport_url value

property response_timeout

Default number of seconds to wait for a response from a call.


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).


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



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.

property transport_url

The transport url