diff --git a/conftest.py b/conftest.py new file mode 100644 index 000000000..f6b59a455 --- /dev/null +++ b/conftest.py @@ -0,0 +1,21 @@ +""" +Global PyTest configuration. + +This file is automatically loaded by PyTest before running any tests and is used +to define global fixtures and command line options. Command line options can +only be defined in this file. +""" + +import pytest + + +def pytest_addoption(parser: pytest.Parser) -> None: + """Define additional command lines to customise the examples.""" + parser.addoption( + "--broker-url", + help=( + "The URL of the broker to use. If this option has been given, the container" + " will _not_ be started." + ), + type=str, + ) diff --git a/examples/conftest.py b/examples/conftest.py index aa1de61b1..eba8ffc73 100644 --- a/examples/conftest.py +++ b/examples/conftest.py @@ -21,18 +21,6 @@ EXAMPLE_DIR = Path(__file__).parent.resolve() -def pytest_addoption(parser: pytest.Parser) -> None: - """Define additional command lines to customise the examples.""" - parser.addoption( - "--broker-url", - help=( - "The URL of the broker to use. If this option has been given, the container" - " will _not_ be started." - ), - type=str, - ) - - @pytest.fixture(scope="session") def broker(request: pytest.FixtureRequest) -> Generator[URL, Any, None]: """