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

Add --namespace fixture to pytest

parent 3caee52d
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,9 @@ import pytest ...@@ -2,7 +2,9 @@ import pytest
def pytest_addoption(parser): 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 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): ...@@ -11,8 +13,18 @@ def pytest_addoption(parser):
help="Name of the app to test, default: all" 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 @pytest.fixture
def app(request): def app(request):
"""Process new cli option.""" """Process new cli option."""
return request.config.getoption("--app") 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.
Finish editing this message first!
Please register or to comment