Public ElementsΒΆ

The DecoratorΒΆ

Module: pytest_csv_params.decorator

This module defines/publishes the main decorator.

pytest_csv_params.decorator.csv_params(data_file, base_dir=None, id_col=None, data_casts=None, dialect=CsvParamsDefaultDialect, header_renames=None)ΒΆ

Decorator @csv_params

For supported arguments, see add_parametrization().

Return type:

MarkDecorator

The CSV DialectΒΆ

Module: pytest_csv_params.dialect

Definition of CSV dialects (CSV file formats). At the moment, there is only the default dialect CsvParamsDefaultDialect.

class pytest_csv_params.dialect.CsvParamsDefaultDialectΒΆ

This is the default dialect (or CSV file format) for parametrizing test. It is used when no other dialect is defined.

One can easily adapt it to match your own CSV files. Just use this or csv.Dialect as base class.

See csv.Dialect for configuration reference.

The ExceptionsΒΆ

Module: pytest_csv_params.exception

Collection of all plugin specific exceptions. All exceptions are derived from very common base types, such as FileNotFoundError, IOError or ValueError to ease the exception handling.

exception pytest_csv_params.exception.CsvHeaderNameInvalidΒΆ

This exception is thrown when a CSV file contains an invalid header name that could not be replaced.

exception pytest_csv_params.exception.CsvParamsDataFileInaccessibleΒΆ

This exception is thrown when the CSV file is inaccessible.

exception pytest_csv_params.exception.CsvParamsDataFileInvalidΒΆ

This exception is thrown when a CSV file contains invalid data.

See the exception message for more details.

exception pytest_csv_params.exception.CsvParamsDataFileNotFoundΒΆ

This exception is thrown when a CSV file was not found.

Plugin CodeΒΆ

Module: pytest_csv_params.plugin

Pytest Plugin Entrypoint: This module contains all the code to initialize the pytest plugin. This is the entrypoint configured in the pyproject.toml as pytest11.

pytest_csv_params.plugin.pytest_addoption(parser, plugin_name='csv-params')ΒΆ

Hook our _ptcsvp.cmdline.pytest_addoption() method to setup our command line arguments

Return type:

None

pytest_csv_params.plugin.pytest_configure(config, plugin_name='csv_params')ΒΆ

Hook our _ptcsvp.configure.pytest_configure() method to setup the plugin setup

Return type:

None

pytest_csv_params.plugin.pytest_unconfigure(config, plugin_name='csv_params')ΒΆ

Hook our _ptcsvp.configure.pytest_unconfigure() method to setup the plugin teardown

Return type:

None

TypesΒΆ

Module: pytest_csv_params.types

This module contains type definitions to ease the usage of the API and its documentation.

Some types are somewhat complex, and it is easier to use a single word/reference instead of a complex typing construct.

pytest_csv_params.types.BaseDirΒΆ

The BaseDir describes the type of the base_dir parameter of the csv_params() decorator to search for non-absolute CSV files. It is simply an optional str.

alias of Optional[str]

pytest_csv_params.types.CsvDialectΒΆ

The CsvDialect describes the type of the dialect parameter of the csv_params() decorator. It is required, but it has an default value in pytest_csv_params.dialect.CsvParamsDefaultDialect.

alias of Type[csv.Dialect]

pytest_csv_params.types.DataCastΒΆ

A DataCast describes how a data casting callable must be implemented. It requires one parameter of the type str and can return anything that is required.

alias of Callable[[str], Any]

pytest_csv_params.types.DataCastDictΒΆ

A DataCastDict describes how a dictionary of data casting callables must look like. The key is a str describing the column name, the value is a DataCast.

alias of Dict[str, Callable[[str], Any]]

pytest_csv_params.types.DataCastsΒΆ

The DataCasts type describes the type of the data_casts parameter of the csv_params() decorator. An optional DataCastDict.

alias of Optional[Dict[str, Callable[[str], Any]]]

pytest_csv_params.types.DataFileΒΆ

The DataFile describes the type if the data_file parameter of the csv_params() decorator to define the CSV file to use. It is an obligatory str.

pytest_csv_params.types.HeaderRenamesΒΆ

The HeaderRenames describes the type of the header_renames parameter of the csv_params() decorator. It is just an optional HeaderRenamesDict.

alias of Optional[Dict[str, str]]

pytest_csv_params.types.HeaderRenamesDictΒΆ

The HeaderRenamesDict describes how a dictionary of header renames must look. Keys and values must both be of type str.

alias of Dict[str, str]

pytest_csv_params.types.IdColNameΒΆ

The IdColName describes the type of the id_col parameter of the csv_params() decorator to name the ID column from a CSV file. It is simply an optional str.

alias of Optional[str]