2022-08-15 14:25:39 +02:00
|
|
|
"""
|
2022-08-25 13:46:19 +02:00
|
|
|
This pytest plugin requires command line arguments that are parsed from the pytest framework. This module contains code
|
|
|
|
to instruct pytest to deliver the required values.
|
2022-08-15 14:25:39 +02:00
|
|
|
"""
|
2022-08-25 13:46:19 +02:00
|
|
|
|
2022-08-15 18:19:39 +02:00
|
|
|
from _pytest.config.argparsing import Parser
|
2022-08-15 14:25:39 +02:00
|
|
|
|
|
|
|
HELP_TEXT = "set base dir for getting CSV data files from"
|
2022-08-25 13:46:19 +02:00
|
|
|
"""
|
|
|
|
This is the help text for the command line arguments that is added by :meth:`pytest_addoption`.
|
|
|
|
"""
|
2022-08-15 14:25:39 +02:00
|
|
|
|
|
|
|
|
2022-08-15 18:19:39 +02:00
|
|
|
def pytest_addoption(parser: Parser, plugin_name: str = "csv-params") -> None:
|
2022-08-15 14:25:39 +02:00
|
|
|
"""
|
2022-08-25 13:46:19 +02:00
|
|
|
Entrypoint for pytest to extend the own :class:`Parser` with the things we need extra.
|
|
|
|
|
|
|
|
:param parser: The pytest command line argument parser
|
|
|
|
:param plugin_name: The name of our plugin, with default value
|
2022-08-15 14:25:39 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
group = parser.getgroup(plugin_name)
|
|
|
|
group.addoption(
|
|
|
|
f"--{plugin_name}-base-dir",
|
|
|
|
action="store",
|
|
|
|
type=str,
|
|
|
|
default=None,
|
|
|
|
required=False,
|
|
|
|
help=HELP_TEXT,
|
|
|
|
)
|