pytest-csv-params/_ptcsvp/plugin.py

28 lines
857 B
Python
Raw Normal View History

2022-08-14 22:01:28 +02:00
"""
This module contains the main plugin class. By the time of writing, it is quite unspectacular.
2022-08-14 22:01:28 +02:00
"""
from _pytest.config import Config
2022-08-14 22:01:28 +02:00
BASE_DIR_KEY = "__pytest_csv_params__config__base_dir"
"""
The class attribute key for :class:`Plugin` to store the base dir command line argument value.
"""
2022-08-14 22:01:28 +02:00
class Plugin: # pylint: disable=too-few-public-methods
"""
The main plugin class
Currently, this class is nothing more than the keeper of the value of the command line argument (as defined by
:meth:`_ptcsvp.cmdline.pytest_addoption`.
2022-08-14 22:01:28 +02:00
"""
def __init__(self, config: Config) -> None:
2022-08-14 22:01:28 +02:00
"""
Initialize the class, and simply store the value of the command line argument, as class attribute.
:param config: Pytest configuration
2022-08-14 22:01:28 +02:00
"""
setattr(Plugin, BASE_DIR_KEY, config.option.csv_params_base_dir)