Skip to content

Commit 97ae285

Browse files
committed
fixup! Issue #5/#7 initial pytest plugin to collect metrics and dump to JSON
1 parent 5b27784 commit 97ae285

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

qa/benchmarks/tests/conftest.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,26 @@ def pytest_addoption(parser):
2222
type=int,
2323
help="Only run random selected subset benchmarks.",
2424
)
25+
parser.addoption(
26+
"--openeo-metrics",
27+
metavar="path",
28+
action="store",
29+
dest="openeo_metrics_path",
30+
default=None,
31+
help="File to store openEO metrics.",
32+
)
2533

2634

2735
def pytest_configure(config):
28-
# Don't register on xdist worker nodes
29-
if not hasattr(config, "workerinput"):
36+
openeo_metrics_path = config.getoption("openeo_metrics_path")
37+
if (
38+
openeo_metrics_path
39+
# Don't register on xdist worker nodes
40+
and not hasattr(config, "workerinput")
41+
):
3042
config.pluginmanager.register(
3143
# TODO: create config for this path
32-
OpeneoMetricReporter(Path("openeo_metrics.json")),
44+
OpeneoMetricReporter(openeo_metrics_path),
3345
name="openeo_metrics_reporter",
3446
)
3547

0 commit comments

Comments
 (0)