Skip to content

test(project): close the gaps the merge-wave reviews left in the guard tests (#1902) - #1904

Merged
JarryShaw merged 1 commit into
mainfrom
test/1902-guard-test-gaps
Oct 19, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/1902-guard-test-gaps

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 19, 2026 •

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

These close the four gaps the merge-wave cross-reviews left.

Each new check fails with its fix reverted. tests/project, tests/test_support_helpers.py and the tier guard pass on 3.14, and under plain unittest on 3.8 the touched test classes pass.

Closes #1902

…d tests (#1902)

- ast.unparse guard: only the branch of an `if`, or the test under a
  `skipIf`/`skipUnless`, that runs on 3.9 or later counts as gated, so an
  `else:` use, a gate pointing the wrong way and a reversed `skipIf` are
  flagged; `getattr(ast, 'unparse')` counts as a use.
- Version-directive guard: match any whitespace after `..`, so
  `..  versionchanged::` is caught.
- Conda pin workflow test: read each `pip install` line as the shell does,
  ignoring what follows a `#`, and match requirement names, so
  `requests[socks]` and `requests>=2` count.
- time_limit tests that drop the first raise hold the deadline back until
  the body's `try` arms it, and a new test stalls before that `try`.

Closes #1902
@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 19, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 19, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at c54724d17. A Sonnet cross-review checked all four fixes:

  • ast.unparse scan: it gave the right answer on 28 probe snippets, including elif chains, nested gates, a (3, 8) threshold, conditional expressions, aliases and getattr with a default. The real tree still passes.
  • Directive regex: it finds exactly what the old one found in every pcapkit/**/*.py file, and it now also catches two spaces or a tab.
  • pip_installs(): it drops anything after a # and reads requests[socks] and requests>=2 as requests.
  • held_deadline(): it holds only the first arm. With time_limit's re-arm removed, the repeat tests fail. TimeLimitTests passed in 20 of 20 loops.
  • Suites: tests/project, tests/test_support_helpers.py and the tier guard pass. The touched classes pass on 3.8.

Not blocking: the scan accepts version_info[1:] >= (9,), and the regex also matches .. followed by a newline, which is a reST comment. Neither occurs in the tree.

@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 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 90.07% (unit tier, Python 3.15, c54724d17, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 2 20 2 96.77%
pcapkit/const 19595 881 2618 867 92.11%
pcapkit/corekit 2504 70 792 36 96.54%
pcapkit/dumpkit 276 3 100 3 98.40%
pcapkit/foundation 2916 164 1016 34 93.59%
pcapkit/interface 138 7 52 5 93.68%
pcapkit/protocols 17411 224 4580 189 98.10%
pcapkit/toolkit 872 177 298 8 77.18%
pcapkit/utilities 522 2 158 4 99.12%
pcapkit/vendor 4431 2341 1018 156 43.64%

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

@JarryShaw
JarryShaw merged commit 727a47d into main Oct 19, 2026
60 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 19, 2026
@JarryShaw
JarryShaw deleted the test/1902-guard-test-gaps branch October 19, 2026 03:52
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 19, 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(project): close the gaps the merge-wave reviews left in the new guard tests

1 participant