fixture.base

Abstract (base) Fixture components.

The more useful bits are in fixture.loadable

class fixture.base.Fixture(dataclass=None, loader=None)

An environment for loading data.

An instance of this class can safely be a module-level object. It may be more useful to use a concrete LoadableFixture, such as SQLAlchemyFixture

Keywords arguments:

dataclass
class to instantiate with datasets (defaults to SuperSet)
loader
class to instantiate and load data sets with.
data(*datasets)
returns a FixtureData object for datasets.
with_data(*datasets, **cfg)

returns a decorator to wrap data around a method.

All positional arguments are DataSet class objects.

the decorated method will receive a new first argument, the Fixture.Data instance.

Keyword arguments:

setup
optional callable to be executed before test
teardown
optional callable to be executed (finally) after test
class fixture.base.FixtureData(datasets, dataclass, loader)

Loads one or more DataSet objects and provides an interface into that data.

Typically this is attached to a concrete Fixture class and constructed by data = fixture.data(...)

setup()
load all datasets, populating self.data.
teardown()
unload all datasets.

Previous topic

TempIO: A Temporary File System

Next topic

fixture.dataset