parametrize_from_file

Parametrize test functions with values read from config files.

Note that this module itself can be used as an alias for parametrize, e.g.:

import parametrize_from_file

@parametrize_from_file
def test_my_func(given, expected):
    assert my_func(given) == expected

This is the recommended usage if you do not need to import any other names from the module. If you do need to import other names, the recommendation is instead to import the module as pff, e.g.:

import parametrize_from_file as pff

@pff.fixture
def env(request):
    return request.param

@pff.parametrize
def test_my_func(given, expected, env):
    assert my_func(given) == expected

Functions

add_loader(suffix, loader)

Read test parameters from a custom file type.

cast(**funcs)

Return a schema function that will apply functions to the given test parameters.

defaults(**defaults)

Return a schema function that will add the given default values to test cases.

drop_loader(suffix)

Prevent parameters from being read from files with the given suffix.

error(exc_spec, *[, globals])

Create a context manager that will check that the specified exception is raised.

error_or(*expected[, globals, param, ...])

Return a schema function that will expect to be given either an error or the specified set of expected values.

fixture([path, key, loaders, preprocess, schema])

Parametrize a fixture function with values read from a config file.

load_parameters(path, key, *[, loaders, ...])

Load test parameters from a file.

parametrize([path, key, loaders, ...])

Parametrize a test function with values read from a config file.

rename([names])

Return a schema function that will rename the specified parameters.

star(module)

Return a dictionary containing all public attributes exposed by the given module.

Classes

Namespace(*args, **kwargs)

Evaluate and/or execute snippets of python code, with powerful control over the names available to those snippets.

Exceptions

ConfigError([brief])

Raised when unable to find and/or load test parameters.