Skip to content

Split the four largest browser test modules into packages by subject - #3087

Merged
max-sixty merged 2 commits into
mainfrom
split-test-files
Oct 16, 2026
Merged

max-sixty merged 2 commits into
mainfrom
split-test-files

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The four largest browser test modules, test_render_navigation, _threads, _widgets and _margin (11k–15k lines each), become packages under tests/browser/: navigation/, threads/, widgets/ and margin/, 47 modules of 400–2000 lines, each named and documented for the behavior it protects.

What moved where. A helper or constant one module uses moves with it; one that several modules use, or that another directory imports, goes in the package's __init__.py. The eleven definitions only a journeys/ module used now live in that module. tests/AGENTS.md states the layout beside the existing cross-tier module convention.

Nothing in the moved code changed, checked two ways: every top-level definition's AST is identical to main's, and the collected test ids are identical (1037 before and after). The exception is twelve widgets definitions that found examples through Path(__file__).parents[N], which would have pointed one directory too high; they now read render_harness.ROOT.

--changed-since reads nested modules. _base_sources in tests/conftest.py matched base test files only one directory deep, so every test in a package would have counted as edited on each landing and run in every gate. It now matches any depth; on this branch the selection adds only the 15 browser tests whose source text changed (the ROOT reads and the rewritten inline imports).

Branches that edit these four modules will conflict with this once it lands: a change to a test there moves to the module that now holds the test.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits October 15, 2026 15:19
test_render_navigation, _threads, _widgets and _margin (11k-15k lines
each) become tests/browser/{navigation,threads,widgets,margin}/, 47
modules of 400-2000 lines, each named and documented for the behavior
it protects. A helper one module uses moves with it; the package's
__init__.py holds those several modules or other directories import.
Constants only a journeys module used move into that module.

Every definition is unchanged except the widgets tests that located
examples through Path(__file__).parents[N], which now read
render_harness.ROOT. The collected test ids are identical before and
after.

--changed-since read base sources only one directory deep, so every
test in a package would have counted as edited on each landing; it now
reads them at any depth. tests/AGENTS.md states the package layout.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	tests/browser/test_render_margin.py
#	tests/browser/test_render_navigation.py
#	tests/browser/test_render_widgets.py
#	tests/journeys/test_render_drafts.py
@max-sixty
max-sixty merged commit 5ebdca1 into main Oct 16, 2026
4 of 6 checks passed
@max-sixty
max-sixty deleted the split-test-files branch October 16, 2026 08:04
max-sixty added a commit that referenced this pull request Oct 16, 2026
The second round after #3087: six more test modules of 6k–7.7k lines
become packages by subject, laid out the same way.

| Source | Package | Modules |
|---|---|---|
| `browser/test_render_projection.py` | `browser/projection/` | 10 |
| `browser/test_render_drafts.py` | `browser/drafts/` | 10 |
| `browser/test_render_startup.py` | `browser/startup/` | 10 |
| `browser/test_render_controls.py` | `browser/controls/` | 9 |
| `model/test_interact_contract.py` | `model/interact_contract/` | 10 |
| `process/test_website_server.py` | `process/website_server/` | 9 |

**New in this round.** `website_server`'s autouse fixture has to reach
every module, so the package's `conftest.py` imports it, and
`tests/AGENTS.md` now says that. The three regtest recordings move
beside their tests' new modules, and the reset command they quote names
the new path. The three modules that took `leaf_page` through
`test_render_controls` import it from `render_harness`, where it is
defined. Definitions only a journeys module reached, directly or through
another such definition, move into that module (most of them into
`journeys/test_render_controls.py`).

**Nothing else in the moved code changed.** Each package collects the
same test ids as its source, and every definition's AST matches `main`'s
except for the quoted paths above, function-local imports ruff dropped
where the new module imports the same name at the top, one
`Path(__file__).parents[N]` deepened, and a docstring that pointed at
"the rule above" across what is now a module boundary.

All model and process tests in the new packages and their importers pass
(494), as does the first browser test of each new module.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants