2022-08-14 22:01:28 +02:00
|
|
|
"""
|
2022-08-25 13:46:19 +02:00
|
|
|
The pytest plugin needs a setup (:meth:`pytest_configure`) and a teardown (:meth:`pytest_unconfigure`) method
|
|
|
|
registered. This module contains the required methods for that.
|
2022-08-14 22:01:28 +02:00
|
|
|
"""
|
2022-08-25 13:46:19 +02:00
|
|
|
|
2022-08-15 18:19:39 +02:00
|
|
|
from _pytest.config import Config
|
2022-08-14 22:01:28 +02:00
|
|
|
|
|
|
|
from _ptcsvp.plugin import Plugin
|
|
|
|
|
|
|
|
|
2022-08-15 19:32:09 +02:00
|
|
|
def pytest_configure(config: Config, plugin_name: str = "csv_params") -> None:
|
2022-08-14 22:01:28 +02:00
|
|
|
"""
|
|
|
|
Register our Plugin
|
2022-08-25 13:46:19 +02:00
|
|
|
|
|
|
|
:param config: Pytets configuration class
|
|
|
|
:param plugin_name: The name of the pytest plugin, with default value
|
2022-08-14 22:01:28 +02:00
|
|
|
"""
|
|
|
|
config.pluginmanager.register(Plugin(config), f"{plugin_name}_plugin")
|
|
|
|
|
|
|
|
|
2022-08-15 19:32:09 +02:00
|
|
|
def pytest_unconfigure(config: Config, plugin_name: str = "csv_params") -> None:
|
2022-08-14 22:01:28 +02:00
|
|
|
"""
|
|
|
|
Remove our Plugin
|
2022-08-25 13:46:19 +02:00
|
|
|
|
|
|
|
:param config: Pytest configuration class
|
|
|
|
:param plugin_name: The name of the pytest plgin, with default value
|
2022-08-14 22:01:28 +02:00
|
|
|
"""
|
|
|
|
config.pluginmanager.unregister(f"{plugin_name}_plugin")
|