Skip to content

test: name tests for the behaviour they check (#2227) - #2248

Merged
JarryShaw merged 1 commit into
mainfrom
test/2227-test-names
Oct 26, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/2227-test-names

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • test — tests only

Description

Part of #2227. Test names, subTest labels and one assertion message are renamed for the behaviour they check, rather than a change, a count or something false. The change touches 56 files under tests/.

  • Named in the issue:
    • test_key_path_minting_is_preserved → test_key_path_resolves_without_minting
    • test_mh_opaque_message_body_cannot_be_padded → …_is_padded_with_a_warning
    • test_37_to_39_run_where_setup_python_still_builds_them → test_each_runner_pinned_version_runs_on_its_pinned_runner
    • the test_<cls>_call_<module>_py_<N> family → test_field_base_call, test_list_field_call and so on
  • Change-relative: *_no_longer_mints → *_does_not_mint, *_matches_the_old_shape → *_matches_the_tracebacklimit_zero_shape, and TestTheCheckNamesAreUnchanged → TestEachLegIsNamedForItsVersion. The full list is in the commit.
  • Counted: AllSevenInheritTheBareClassmethodTests → EachInheritsTheBareClassmethodTests, and similar.
  • Kept: a _still_ that means "continues to", spec and test-data counts, and failure messages that describe drift.
  • Left for a follow-up: about ten names in files other open PRs own (the 908 and 1940 docs-refs tests, test_changelog_md, test_unit_tests_queue, test_conventions_doc_claims and the registry tests). They are renamed once those PRs land.
  • References: every old name was grepped repo-wide, and every hit was in tests/ and updated.
  • Tests run: the touched files, the tier guard, the docstring contract and test_issue_refs_in_comments give 1430 passed. Renames need no fail-without-fix.

Test names, subTest labels and one assertion message described a change,
counted codebase items, encoded a file:line, or said the opposite of what
the test asserts. Rename each for the behaviour it pins and update every
docstring that names a renamed test. Rename only: no fail-without-fix test
applies.
@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at 723f71f03 (Sonnet).

  • Renames: 117 across 53 files. I read 30 test bodies, including every one the PR body names, and each new name matches what the test asserts.
  • References: none of the old names remains anywhere in the tree, including _tiers.py, docs and workflows. No new name collides.
  • Collection: 6512 tests on both the head and origin/main.
  • Tests: the touched files, the tier guard, the docstring contract and issue-refs give 1430 passed.
  • Not blocking: test_register_alias_goes_through_the_shared_sanitizer asserts the sanitised name, not that the sanitizer is shared.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 26, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.56% (unit tier, Python 3.15, 723f71f03, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 881 2618 867 92.11%
pcapkit/corekit 2589 74 816 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2994 23 1038 25 98.81%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17433 218 4584 185 98.15%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 504 7 146 5 98.15%
pcapkit/vendor 4432 1988 1018 167 51.87%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at 723f71f03. Part of #2227. About ten names in files other PRs owned are left for a follow-up once those land.

  • Review: Sonnet GOOD TO GO, first round. It ran 117 renames, with 6512 tests collected on both the head and main.
  • CI: all checks complete, Required checks passed SUCCESS, 0 failed.
  • KTLO: 12 legs, no warnings.
  • Ordering: merged into main and run, 0 failures on every leg: project 2353, protocols 1924, foundation 740, corekit 924.
  • Conflicts: none against the current main.

@JarryShaw
JarryShaw merged commit b1405a6 into main Oct 26, 2026
67 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 26, 2026
@JarryShaw
JarryShaw deleted the test/2227-test-names branch October 26, 2026 14:53
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 26, 2026
JarryShaw added a commit that referenced this pull request Oct 26, 2026
Renames (assertions unchanged):
- test_case_sensitivity_from_896_still_holds -> test_get_matches_names_case_sensitively
- test_get_is_now_a_classmethod_bound_the_same_way_for_callers -> test_get_is_a_classmethod_that_binds_to_the_class
- test_default_still_names_the_unregistered_members_value -> test_default_names_the_unregistered_members_value
- test_sibling_registries_now_stay_quiet_on_an_identical_re_registration -> test_sibling_registries_stay_quiet_on_an_identical_re_registration
- test_the_two_new_sub_heading_levels_become_atx_headings -> test_dash_and_tilde_sub_headings_become_atx_headings
- test_the_two_redundant_overrides_are_gone -> test_the_mh_helpers_define_no_get_override
- test_the_all_extra_is_exactly_the_three_core_addon_extras -> test_the_all_extra_is_exactly_the_core_addon_extras
- test_literal_is_now_a_role -> test_each_curated_reference_is_a_role_not_a_literal
- test_the_four_legs_skip_only_on_a_docs_only_diff -> test_each_leg_skips_only_on_a_docs_only_diff
- test_the_three_call_one_head -> test_every_acting_workflow_calls_one_head
- test_registered_lookups_are_still_unaffected -> test_registered_words_resolve_to_their_registered_members
- test_an_out_of_width_port_still_raises_764s_rejection -> test_an_out_of_width_port_raises_while_an_unassigned_one_resolves

Also: the comment and docstring that name two of them; a wrapped
docstring citation of #2248's old test_formerly_attributed_vendor_block_
no_longer_mints, now test_an_attributed_vendor_block_does_not_mint; and
the change-relative assertion messages and docstring wording in the get
override and all-extra checks ("no longer delegates" and kin).

Touched files plus tier guard and docstring contract pass.
JarryShaw added a commit that referenced this pull request Oct 26, 2026
)

Renames (assertions unchanged):
- test_case_sensitivity_from_896_still_holds -> test_get_matches_names_case_sensitively
- test_get_is_now_a_classmethod_bound_the_same_way_for_callers -> test_get_is_a_classmethod_that_binds_to_the_class
- test_default_still_names_the_unregistered_members_value -> test_default_names_the_unregistered_members_value
- test_sibling_registries_now_stay_quiet_on_an_identical_re_registration -> test_sibling_registries_stay_quiet_on_an_identical_re_registration
- test_the_two_new_sub_heading_levels_become_atx_headings -> test_dash_and_tilde_sub_headings_become_atx_headings
- test_the_two_redundant_overrides_are_gone -> test_the_mh_helpers_define_no_get_override
- test_the_all_extra_is_exactly_the_three_core_addon_extras -> test_the_all_extra_is_exactly_the_core_addon_extras
- test_literal_is_now_a_role -> test_each_curated_reference_is_a_role_not_a_literal
- test_the_four_legs_skip_only_on_a_docs_only_diff -> test_each_leg_skips_only_on_a_docs_only_diff
- test_the_three_call_one_head -> test_every_acting_workflow_calls_one_head
- test_registered_lookups_are_still_unaffected -> test_registered_words_resolve_to_their_registered_members
- test_an_out_of_width_port_still_raises_764s_rejection -> test_an_out_of_width_port_raises_while_an_unassigned_one_resolves

Also: the comment and docstring that name two of them; a wrapped
docstring citation of #2248's old test_formerly_attributed_vendor_block_
no_longer_mints, now test_an_attributed_vendor_block_does_not_mint; and
the change-relative assertion messages and docstring wording in the get
override and all-extra checks ("no longer delegates" and kin).

Touched files plus tier guard and docstring contract pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) test Pull requests that add or correct tests (test: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant