Repository navigation
test: re-import pcapkit only where isolation needs it (#1065) - #1070
Conversation
|
NEEDS CHANGES on
These only show up when many modules share one process. The one-module-per-process runs in the PR description could not see them. The fix has to hold under xdist with the full unit selection. |
|
Cross-review verdict on
|
1d986fd to
2efb76d
Compare
|
Coverage: 88.74% (unit tier, Python 3.14,
Per-file detail: the |
|
Cross-review verdict on
|
- 204 classes purged pcapkit in setUp, re-importing it before every test (~85% of serial suite time). They now call the new tests._support.reimport_once_per_class(self): the first test of a class purges, the class keeps what it imports, and later tests get that import back. A setUpClass purge would not do: under pytest the conftest restore swaps the session pin back before every test, so classes would share and mutate one import. - Fix state that tests left behind for others in the same class or module: pcapng option registry restored by copy, zero-pad ledger, stale schema subclasses, an uncollected test class, unrestored Extractor registries, a scapy-less toolkit import. ConstEnumRegisterFallbackTests and TCPHTTPDispatchTests keep a per-test purge. - #1062 trims: drop the duplicate ipv6_ext and Command.get tests, run the pcapng truncation sweep once per class, sample the AppType dunder sweep (37,173 -> 882 subtests, same arc sets), and make the #857 -1 default test discriminate again on a throwaway registry. 129 affected modules: 2,156 s -> 483 s, one per process under pytest; all pass alone under pytest and plain unittest, in CI-style xdist directory groups, and all unit modules in one process; #981 still fails 1 + 3.
2efb76d to
ae3ceb7
Compare
|
Cross-review verdict on
|
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingchore— anything elseDescription of your pull request and other information
Closes #1065. Closes #1062.
setUppurges becometests._support.reimport_once_per_class(self). Each class gets one private pcapkit import, which its own tests share. AsetUpClasspurge would not work, because the conftest restore swaps the shared session import back in before every test. Plain unittest still leaves the class's import behind, so test: three modules pass alone but fail together, and pytest reports it green #981's reproduction (test_http_unitthentest_base_class_contracton32bcfba15^) still gives 1 failure and 3 errors.ConstEnumRegisterFallbackTestsandTCPHTTPDispatchTestskeep a per-test purge.-1test now discriminates again.-n 4directory groups, all unit modules in one process (forward), reversed in four chunks, and the PyPCAPFile engine leg on 3.10.