Skip to content

test: run the 3.9+ and 3.10+ stdlib tests on every supported Python (#1695) - #1697

Merged
JarryShaw merged 1 commit into
mainfrom
test/1695-tests-on-py38-py39
Oct 14, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/1695-tests-on-py38-py39

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Please follow the guide below

What is the purpose of your pull request?

Tick the commit type your subject line carries.

  • fix — corrects a defect
  • feat — adds a feature
  • perf — changes performance, not behaviour
  • refactor — changes neither behaviour nor performance
  • test — tests only
  • docs — documentation only
  • ci — workflows or build tooling
  • release — bumps the version or rolls up a distribution
  • chore — anything else

Description of your pull request and other information

The 13 KTLO failures from #1695 now run on 3.8 and 3.9. Nothing is skipped.

  • assertNoLogs (3.10+) is replaced by a local assert_no_logs that takes the logger over the same way. On 3.8 it catches the dumper's real unsupported object type warning.
  • tuple[str] used as a class base becomes typing.Tuple[str]. Before this, the name= collision case in test_reassembly_base.py passed on 3.8 by accident: tuple[str] raised the TypeError the test was waiting for. It now raises __new__() got multiple values for argument 'name'.
  • ast.unparse (3.9+) becomes ast.get_source_segment where the tests match text. test_final_enforcement.py compares ast.dump trees, so reformatting the guard still passes and moving the boundary still fails. The same change also covers the bare-annotation branch at test_extraction.py:201, which the KTLO legs never reached.
  • test_module_isolation.py used to blame twelve tests/project/ tests fail with TypeError: type 'ProtocolBase' is not subscriptable depending on what ran first: the fake-module helpers purge on entry and never restore on exit #660 for any failure in its nested run. It now names the nested tests that failed. With the old test_documentation_claims.py on 3.8, the message names TestNoEOFDocumentedOnce::test_documented_sense_matches_the_code.

On origin/main, 3.8 fails 13 and 3.9 fails 1. After the change, the seven modules pass 109 tests on 3.8.20, 3.9.25, 3.10.21 and 3.14.8. The 3.14 run still has 1843 subtests and 0 skips, the same as before.

Two leftovers outside these files: tests/test_base_class_contract.py:249 calls str.removesuffix (3.9+). It never runs today because PENDING_ALIAS_PATHS is empty. The type[...] | type[...] at tests/dumpkit/test_nameless_enum_rendering_unit.py:18 sits under TYPE_CHECKING, so it is never evaluated.

Closes #1695

…1695)

- assertNoLogs is 3.10+: test_dumper_roundtrip_unit uses a local
  assert_no_logs that takes the logger over the same way.
- tuple[str] as a class-base subscript is 3.9+: the reassembly and
  extraction tests spell it typing.Tuple[str]. On 3.8 the collision case
  in test_reassembly_base passed only because tuple[str] itself raised
  the TypeError it expected.
- ast.unparse is 3.9+: test_documentation_claims, the apptype composite
  sweep and test_extraction read nodes back with ast.get_source_segment;
  test_final_enforcement compares the compat guard with ast.dump, so
  reformatting it still does not fail the test.
- test_module_isolation names the nested tests that failed instead of
  blaming collection order (#660) for every nested failure.

The seven modules: 109 passed on 3.8.20, 3.9.25, 3.10.21 and 3.14.8.
@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Oct 14, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 14, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at ac2673ecb. A Sonnet cross-review re-ran all 7 modules. On base 8035434a2 they fail 13 tests on 3.8 and 1 on 3.9. On this head they pass with 109 tests on 3.8, 3.9, 3.10 and 3.14, and nothing is skipped. On 3.14 the test and subtest counts are unchanged (109 / 1843). The hand-rolled assert_no_logs matched stdlib assertNoLogs on all 9 cases on 3.10 and 3.14. The review also confirmed a false pass the fix removes: on 3.8 the name= collision test was passing only because tuple[str] itself raised TypeError.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 89.47% (unit tier, Python 3.15, ac2673ecb, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 3 20 3 95.16%
pcapkit/const 18858 954 2366 868 91.06%
pcapkit/corekit 2366 67 760 35 96.48%
pcapkit/dumpkit 275 3 100 3 98.40%
pcapkit/foundation 3035 151 1076 34 94.28%
pcapkit/interface 138 7 52 5 93.68%
pcapkit/protocols 17166 226 4580 190 98.07%
pcapkit/toolkit 1437 279 592 5 78.12%
pcapkit/utilities 494 4 146 4 98.75%
pcapkit/vendor 4417 2342 1010 157 43.38%

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

@JarryShaw
JarryShaw merged commit 96365a3 into main Oct 14, 2026
54 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 14, 2026
@JarryShaw
JarryShaw deleted the test/1695-tests-on-py38-py39 branch October 14, 2026 02:41
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 14, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Pull requests that add or correct tests (test: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test: 13 tests use standard-library features newer than Python 3.8 or 3.9, so the KTLO legs fail them

1 participant