fixtures.pytest_store module

Storage for pytest objects during test runs

The objects in the module will change during the course of a test run, so they have been stashed into the ‘store’ namespace

Usage:

# as pytest.store
import pytest
pytest.store.config, pytest.store.pluginmanager, pytest.store.session

# imported directly (store is pytest.store)
from fixtures.pytest_store import store
store.config, store.pluginmanager, store.session

The availability of these objects varies during a test run, but all should be available in the collection and testing phases of a test run.

class fixtures.pytest_store.FlexibleTerminalReporter(config=None, file=None)[source]

Bases: _pytest.terminal.TerminalReporter

A TerminalReporter stand-in that pretends to work even without a py.test config.

class fixtures.pytest_store.Store[source]

Bases: object

pytest object store

If a property isn’t available for any reason (including being accessed outside of a pytest run), it will be None.

base_url[source]

If there is a current appliance the base url of that appliance is returned else, the base_url from the config is returned.

capturemanager[source]
config = None

The py.test config instance, None if not in py.test

current_appliance[source]
fixturemanager[source]
has_config[source]
in_pytest_session[source]
my_ip_address[source]
parallel_session[source]
parallelizer_role = None

Parallelizer role, None if not running a parallelized session

pluginmanager[source]
session = None

The current py.test session, None if not in a py.test session

slave_manager[source]
terminaldistreporter[source]
terminalreporter[source]
user[source]
write_line(line, **kwargs)[source]
fixtures.pytest_store.pytest_configure(config)[source]
fixtures.pytest_store.pytest_namespace()[source]
fixtures.pytest_store.pytest_sessionstart(session)[source]
fixtures.pytest_store.write_line(line, **kwargs)[source]

A write-line helper that should always write a line to the terminal

It knows all of py.tests dirty tricks, including ones that we made, and works around them.

Parameters:**kwargs – Normal kwargs for pytest line formatting, stripped from slave messages