From b0de499a7d6c6c90c9a70941767451600d363545 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Wed, 22 Nov 2023 14:09:12 +0100 Subject: [PATCH] Make provenance test independent of test execution order --- ctapipe/core/tests/test_provenance.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ctapipe/core/tests/test_provenance.py b/ctapipe/core/tests/test_provenance.py index 12994090413..f67f8a68742 100644 --- a/ctapipe/core/tests/test_provenance.py +++ b/ctapipe/core/tests/test_provenance.py @@ -7,8 +7,15 @@ @pytest.fixture -def provenance(): +def provenance(monkeypatch): + # the singleton nature of Provenance messes with + # the order-independence of the tests asserting + # the provenance contains the correct information + # so we monkeypatch back to an empty state here prov = Provenance() + monkeypatch.setattr(prov, "_activities", []) + monkeypatch.setattr(prov, "_finished_activities", []) + prov.start_activity("test1") prov.add_input_file("input.txt") prov.add_output_file("output.txt")