Skip to content

Collapse repetitive tests into parametrized tests#2

Merged
kaapstorm merged 1 commit into
mainfrom
nh/test_refactor
Apr 28, 2026
Merged

Collapse repetitive tests into parametrized tests#2
kaapstorm merged 1 commit into
mainfrom
nh/test_refactor

Conversation

@kaapstorm
Copy link
Copy Markdown
Owner

  • test_discover.py: 7 fixture-name-mapping tests → 1
  • test_walk.py: 3 directory-exclusion tests → 1
  • test_config.py: 3 invalid-pyproject tests → 1
  • test_targets.py: 3 file-path tests + 3 dotted-selector tests → 2
  • test_cli.py: 4 happy-path CLI tests + 3 stderr-error tests → 2

- test_discover.py: 7 fixture-name-mapping tests → 1
- test_walk.py: 3 directory-exclusion tests → 1
- test_config.py: 3 invalid-pyproject tests → 1
- test_targets.py: 3 file-path tests + 3 dotted-selector tests → 2
- test_cli.py: 4 happy-path CLI tests + 3 stderr-error tests → 2

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kaapstorm kaapstorm merged commit acafa72 into main Apr 28, 2026
4 checks passed
@kaapstorm kaapstorm deleted the nh/test_refactor branch April 28, 2026 03:21
kaapstorm added a commit that referenced this pull request May 3, 2026
Findings #2, #5, #9, #10, #11, #12, #13, #15, #16 from the codebase
review. Single commit because each change is small and they touch
overlapping files.

* #16 Re-export Plugin, ENTRY_POINT_GROUP, and DiscoveryConfig from
  testsweet/__init__.py so plugin authors and embedders don't have
  to import from private modules.
* #5/#11/#12 Module docstrings on _resolve, _targets, _walk, _loaders,
  _classify, _config, _discover, _runner, _catches, _params; doc-
  strings on test_params, test_params_lazy, catch_exceptions,
  catch_warnings, run, discover; clarify _build_plan's None/set
  invariant.
* #15 Extract _looks_like_filesystem_path from parse_target so the
  heuristic has a name.
* #2 New scoped_sys_path() context manager in _loaders.py owns the
  snapshot/restore primitive; __main__ uses it instead of an inline
  try/finally.
* #9 Replace load-bearing asserts (vanish under python -O) with
  conditional raises in _classify._resolve_dotted, and replace
  catch_warnings.__exit__ asserts with explicit None checks plus
  typing.cast for the WarningMessage.message narrowing.
* #10 _resolve_include_paths and _build_exclude_set drop glob matches
  that resolve outside project_root.
* #13 _to_string_tuple deduplicates its error message.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant