fix(8249): test groups come smallest first, and a big one is read as a feature area
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 2m14s
CI & Build / integration (push) Successful in 2m28s
CI & Build / Build & push image (push) Successful in 35s

A group is the set of tests reaching the same code from different files. A
test that drives a feature through its one entry point reaches exactly that
entry point whatever it checks, so the largest groups are a feature tested
from many files, not copies. Listing them first buried the two- and
three-test groups where one-for-one duplicates are. The readout, the tool and
the panel now list smallest first; each group says copies or area and how
many files it spans, and the panel tells an area to fold its scattered cases
into one file. Plugin 2026.12.01.0748.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 02:49:06 -05:00
co-authored by Claude Opus 5.5
parent 70ca2e8a11
commit 7c7a1a7ab9
6 changed files with 62 additions and 9 deletions
+10
View File
@@ -131,6 +131,16 @@ def test_a_group_spans_files_and_one_file_never_forms_one():
assert groups == [(same, [10, 11])]
def test_the_smallest_groups_come_first_and_a_big_one_reads_as_a_feature_area():
pair, area = frozenset({1}), frozenset({2})
tests = [(10, "tests/test_a.py", pair), (11, "tests/test_b.py", pair)]
tests += [(20 + i, f"tests/test_{i % 2}.py", area) for i in range(6)]
groups = tg.same_guard_groups(tests)
assert [g for g, _members in groups] == [pair, area]
assert tg.group_kind(len(groups[0][1])) == "copies"
assert tg.group_kind(len(groups[1][1])) == "area"
def test_a_group_is_named_by_its_members_in_any_order():
a = tg.group_key([("tests/a.py", "test_1"), ("tests/b.py", "test_2")])
assert a == tg.group_key([("tests/b.py", "test_2"), ("tests/a.py", "test_1")])