Skip to content
Snippets Groups Projects
Unverified Commit 4539e317 authored by Varac's avatar Varac
Browse files

Add --namespace fixture to pytest

parent 3caee52d
Branches
Tags
No related merge requests found
......@@ -2,7 +2,9 @@ import pytest
def pytest_addoption(parser):
"""Add option `--app` to select specific app to test.
"""Add pytest options:
--app: Select specific app to test
--namespace: Use specific namespace to look for app
See https://docs.pytest.org/en/stable/example/simple.html#pass-different-values-to-a-test-function-depending-on-command-line-options
"""
......@@ -11,8 +13,18 @@ def pytest_addoption(parser):
help="Name of the app to test, default: all"
)
parser.addoption(
"--namespace", action="store", default="",
help="Namespace of the app to test, default: <empty>"
)
@pytest.fixture
def app(request):
"""Process new cli option."""
return request.config.getoption("--app")
@pytest.fixture
def namespace(request):
"""Process new cli option."""
return request.config.getoption("--namespace")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment