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, reuse_id_col=False)ΒΆ
Decorator
@csv_paramsFor 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.Dialectas base class.See
csv.Dialectfor configuration reference.
The ShortcutsΒΆ
Module: pytest_csv_params.shortcut
Shortcut decorators
- pytest_csv_params.shortcut.csv_params_reusing_id_col(**kwargs)ΒΆ
Shortcut decorator that allows to re-use ID columns as data columns
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.
The WarningsΒΆ
Module: pytest_csv_params.warning
Definitions of all Warnings used in the Plugin
- exception pytest_csv_params.warning.CsvParamsOnlyOneColumnIsUsedAsIdAndDataWarningΒΆ
Raised when only a single column is used for ID and test data, which is most likely a configuration error, but might be valid in some scenarios.
- exception pytest_csv_params.warning.CsvParamsWarningΒΆ
Base class for all PytestCsvParams Plugin Warnings
Use this class if you want to filter out all the warnings of this Plugin
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:
- 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:
- 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:
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
BaseDirdescribes the type of the base_dir parameter of thecsv_params()decorator to search for non-absolute CSV files. It is simply an optionalstr.
- pytest_csv_params.types.CsvDialectΒΆ
The
CsvDialectdescribes the type of the dialect parameter of thecsv_params()decorator. It is required, but it has an default value inpytest_csv_params.dialect.CsvParamsDefaultDialect.alias of
Type[csv.Dialect]
- pytest_csv_params.types.DataCastΒΆ
A
DataCastdescribes how a data casting callable must be implemented. It requires one parameter of the typestrand can return anything that is required.
- pytest_csv_params.types.DataCastDictΒΆ
A
DataCastDictdescribes how a dictionary of data casting callables must look like. The key is astrdescribing the column name, the value is aDataCast.
- pytest_csv_params.types.DataCastsΒΆ
The
DataCaststype describes the type of the data_casts parameter of thecsv_params()decorator. An optionalDataCastDict.
- pytest_csv_params.types.DataFileΒΆ
The
DataFiledescribes the type if the data_file parameter of thecsv_params()decorator to define the CSV file to use. It is an obligatorystr.
- pytest_csv_params.types.HeaderRenamesΒΆ
The
HeaderRenamesdescribes the type of the header_renames parameter of thecsv_params()decorator. It is just an optionalHeaderRenamesDict.
- pytest_csv_params.types.HeaderRenamesDictΒΆ
The
HeaderRenamesDictdescribes how a dictionary of header renames must look. Keys and values must both be of typestr.