Skip to content

Commit 4393cb4

Browse files
committed
allow filtering the backend, avoids to try and run tests that will never work
1 parent e389565 commit 4393cb4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

qa/benchmarks/tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ def pytest_addoption(parser):
3838
type=str,
3939
help="When provided this url will be used instead of the backend listed in the benchmark json files.",
4040
)
41+
parser.addoption(
42+
"--backend-filter",
43+
action="store",
44+
type=str,
45+
help="A regex patter to filter the available scenarios by backend.",
46+
)
4147

4248

4349
def pytest_ignore_collect(collection_path, config):

qa/benchmarks/tests/test_benchmarks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import re
23
from pathlib import Path
34

45
import openeo
@@ -36,6 +37,10 @@ def test_run_benchmark(
3637
track_metric("scenario_id", scenario.id)
3738
# Check if a backend override has been provided via cli options.
3839
override_backend = request.config.getoption("--override-backend")
40+
backend_filter = request.config.getoption("--backend_filter")
41+
if backend_filter and not re.match(backend_filter, scenario.backend):
42+
#TODO apply filter during scenario retrieval, but seems to be hard to retrieve cli param
43+
pytest.skip(f"skipping scenario {scenario.id} because backend {scenario.backend} does not match filter {backend_filter!r}")
3944
backend = scenario.backend
4045
if override_backend:
4146
_log.info(f"Overriding backend URL with {override_backend!r}")

0 commit comments

Comments
 (0)