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

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

def env(request):
    return request.param

def test_my_func(given, expected, env):
    assert my_func(given) == expected


add_loader(suffix, loader)

Read test parameters from a custom file type.


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


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


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.


Return a schema function that will rename the specified parameters.


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


Namespace(*args, **kwargs)

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



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