From aab5c68b26b526b44df8c37b2c3fa3693b4c28e4 Mon Sep 17 00:00:00 2001 From: Julian Geiger Date: Mon, 6 Oct 2025 16:00:52 +0200 Subject: [PATCH 1/2] add seed based on test parameters to json contains tests --- tests/benchmark/test_json_contains.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/benchmark/test_json_contains.py b/tests/benchmark/test_json_contains.py index 3ec2393b17..e32abe1025 100644 --- a/tests/benchmark/test_json_contains.py +++ b/tests/benchmark/test_json_contains.py @@ -62,6 +62,7 @@ def extract_component(data, p: float = -1): @pytest.mark.parametrize('breadth', [1, 2, 4]) @pytest.mark.usefixtures('aiida_profile_clean') def test_deep_json(benchmark, depth, breadth): + random.seed(depth * 1000 + breadth * 10 + 42) lhs = gen_json(depth, breadth) rhs = extract_component(lhs, p=1.0 / depth) assert 0 == len(QueryBuilder().append(orm.Dict).all()) @@ -89,6 +90,7 @@ def test_deep_json(benchmark, depth, breadth): @pytest.mark.parametrize('breadth', [1, 10, 100]) @pytest.mark.usefixtures('aiida_profile_clean') def test_wide_json(benchmark, depth, breadth): + random.seed(depth * 1000 + breadth * 10 + 42) lhs = gen_json(depth, breadth) rhs = extract_component(lhs, p=1.0 / depth) assert 0 == len(QueryBuilder().append(orm.Dict).all()) @@ -115,6 +117,7 @@ def test_wide_json(benchmark, depth, breadth): @pytest.mark.parametrize('num_entries', LARGE_TABLE_SIZE_RANGE) @pytest.mark.usefixtures('aiida_profile_clean') def test_large_table(benchmark, num_entries): + random.seed(num_entries + 42) data = gen_json(2, 10) rhs = extract_component(data) assert 0 == len(QueryBuilder().append(orm.Dict).all()) From 8f1c5aeb37359f26e48129402e8748325ff21639 Mon Sep 17 00:00:00 2001 From: Julian Geiger Date: Tue, 14 Oct 2025 15:30:23 +0200 Subject: [PATCH 2/2] ignore tests/benchmark/test_json_contains.py from pytest-benchmark GHA --- .github/workflows/benchmark.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 04f8eec141..6a4b65cf5c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -60,7 +60,13 @@ jobs: from-lock: 'true' - name: Run benchmarks - run: pytest --db-backend psql --benchmark-only --benchmark-json benchmark.json tests/ + run: | + pytest + --db-backend psql + --benchmark-only + --benchmark-json benchmark.json + --ignore tests/benchmark/test_json_contains.py + tests/ - name: Store benchmark result uses: aiidateam/github-action-benchmark@v3