Skip to content

Commit 10a0b8a

Browse files
guerlerclaude
andcommitted
Clean up history graph builder test suite
- Replace global _user_counter with uuid4().hex[:8] for xdist safety - Drop test_determinism_identical_requests (duplicate of test_deterministic_ordering) - Lift inline imports (sqlalchemy event, HistoryGraphBuilder) to top - Lower scale defaults (500/100/10/50 -> 250/60/5/20) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 00e9721 commit 10a0b8a

1 file changed

Lines changed: 9 additions & 26 deletions

File tree

test/unit/app/managers/test_HistoryGraphBuilder.py

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
2+
from uuid import uuid4
23

34
import pytest
5+
from sqlalchemy import event
46

57
from galaxy import model
68
from galaxy.exceptions import RequestParameterInvalidException
@@ -15,15 +17,13 @@
1517
)
1618

1719
default_password = "123456"
18-
_user_counter = 0
1920

2021

2122
def _next_user_data():
22-
global _user_counter
23-
_user_counter += 1
23+
suffix = uuid4().hex[:8]
2424
return dict(
25-
email=f"graphuser{_user_counter}@test.test",
26-
username=f"graphuser{_user_counter}",
25+
email=f"graphuser{suffix}@test.test",
26+
username=f"graphuser{suffix}",
2727
password=default_password,
2828
)
2929

@@ -589,19 +589,6 @@ def test_deleted_items_with_include_deleted(self):
589589
graph = builder.build()
590590
assert len(graph.nodes) == 1
591591

592-
def test_determinism_identical_requests(self):
593-
"""Identical requests produce identical output."""
594-
history, _ = self._create_history()
595-
self._build_linear_chain(history, length=3)
596-
597-
graph1 = self._build_graph(history)
598-
graph2 = self._build_graph(history)
599-
600-
assert [n.id for n in graph1.nodes] == [n.id for n in graph2.nodes]
601-
assert [(e.source, e.target, e.type) for e in graph1.edges] == [
602-
(e.source, e.target, e.type) for e in graph2.edges
603-
]
604-
605592
def test_expanding_limit_generally_additive(self):
606593
"""Expanding limit is generally additive for standalone datasets.
607594
@@ -996,8 +983,6 @@ def test_n2_ambiguous_hdca_producer_has_node_but_no_edge(self):
996983
This is the deliberately conservative behavior — we do not pick
997984
an arbitrary winner at the response level.
998985
"""
999-
from galaxy.managers.history_graph import HistoryGraphBuilder
1000-
1001986
history, _ = self._create_history()
1002987
in_hda = self._create_hda(history, name="input")
1003988

@@ -1059,8 +1044,6 @@ def test_seed_filter_issues_no_extra_queries(self):
10591044
subset of the unseeded result (proving it's a pure post-filter,
10601045
not a different construction path).
10611046
"""
1062-
from sqlalchemy import event
1063-
10641047
history, _ = self._create_history()
10651048
# Build a small chain so there's something to filter.
10661049
chain = self._build_linear_chain(history, length=3)
@@ -1177,10 +1160,10 @@ def test_stability_new_items_shift_recent_window(self):
11771160

11781161
# ── Scalability / Boundedness Tests ──
11791162

1180-
GRAPH_SCALE_HISTORY_SIZE = int(os.environ.get("GRAPH_SCALE_HISTORY_SIZE", 500))
1181-
GRAPH_SCALE_CHAIN_LENGTH = int(os.environ.get("GRAPH_SCALE_CHAIN_LENGTH", 100))
1182-
GRAPH_SCALE_COLLECTION_COUNT = int(os.environ.get("GRAPH_SCALE_COLLECTION_COUNT", 10))
1183-
GRAPH_SCALE_COLLECTION_SIZE = int(os.environ.get("GRAPH_SCALE_COLLECTION_SIZE", 50))
1163+
GRAPH_SCALE_HISTORY_SIZE = int(os.environ.get("GRAPH_SCALE_HISTORY_SIZE", 250))
1164+
GRAPH_SCALE_CHAIN_LENGTH = int(os.environ.get("GRAPH_SCALE_CHAIN_LENGTH", 60))
1165+
GRAPH_SCALE_COLLECTION_COUNT = int(os.environ.get("GRAPH_SCALE_COLLECTION_COUNT", 5))
1166+
GRAPH_SCALE_COLLECTION_SIZE = int(os.environ.get("GRAPH_SCALE_COLLECTION_SIZE", 20))
11841167

11851168

11861169
class TestHistoryGraphBuilderBoundedness(BaseTestCase, CreatesCollectionsMixin):

0 commit comments

Comments
 (0)