Skip to content

Commit

Permalink
Add --require-capability cli option
Browse files Browse the repository at this point in the history
- replaces --mgc option
  • Loading branch information
pehala committed Nov 22, 2023
1 parent 9a6196d commit d4744b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ all-is-package:

# pattern to run individual testfile or all testfiles in directory
testsuite/%: FORCE poetry-no-dev
$(PYTEST) --performance --mgc -v $(flags) $@
$(PYTEST) --performance -v $(flags) $@

test: ## Run tests
test pytest tests: poetry-no-dev
Expand All @@ -53,7 +53,7 @@ performance: poetry-no-dev

mgc: ## Run mgc tests
mgc: poetry-no-dev
$(PYTEST) --mgc $(flags) testsuite/tests/mgc
$(PYTEST) -C MGC $(flags) testsuite/tests/mgc

poetry.lock: pyproject.toml
poetry lock
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ line-length = 120
markers = [
"issue: Reference to covered issue",
"performance: Performance tests have unique needs",
"mgc: MGC tests have specific needs"
]
filterwarnings = [
"ignore: WARNING the new order is not taken into account:UserWarning",
Expand Down
11 changes: 8 additions & 3 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,21 @@ def pytest_addoption(parser):
parser.addoption(
"--performance", action="store_true", default=False, help="Run also performance tests (default: False)"
)
parser.addoption("--mgc", action="store_true", default=False, help="Run also mgc tests (default: False)")
parser.addoption(
"--require-capability",
"-C",
action="extend",
nargs="+",
metavar="CAPABILITY",
help="Only tests containing one of these capabilities will be ran",
)


def pytest_runtest_setup(item):
"""Exclude performance tests by default, require explicit option"""
marks = [i.name for i in item.iter_markers()]
if "performance" in marks and not item.config.getoption("--performance"):
pytest.skip("Excluding performance tests")
if "mgc" in marks and not item.config.getoption("--mgc"):
pytest.skip("Excluding MGC tests")


@pytest.hookimpl(hookwrapper=True)
Expand Down

0 comments on commit d4744b5

Please sign in to comment.