Repository navigation
test: spell test_base_class_contract's suffix strip so Python 3.8 runs it (#1699) - #1700
Merged
Merged
Conversation
…s it (#1699) BaseClassAliasTests.test_library_modules_do_not_bind_the_public_name_at_runtime stripped `.py` from each PENDING_ALIAS_PATHS key with `str.removesuffix`, which is Python 3.9+. The dict is empty today, so the line never ran; its first entry would have raised AttributeError on the 3.8 leg. It now reads `rel[:-len('.py')] if rel.endswith('.py') else rel`, the same result. With one entry patched in, the test errors on 3.8 before and passes after; the module is 7 passed, unchanged, on 3.8, 3.9 and 3.14.
Owner
Author
|
Verdict: GOOD TO GO at |
Contributor
|
Coverage: 89.47% (unit tier, Python 3.15,
Per-file detail: the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
tests/test_base_class_contract.py:249stripped.pyfrom eachPENDING_ALIAS_PATHSkey withstr.removesuffix(3.9+). The dict is empty, so the line never ran; its first entry would raiseAttributeErroron the 3.8 leg. It now readsrel[:-len('.py')] if rel.endswith('.py') else rel, equal toremovesuffix('.py')on all 2,311 paths and directory prefixes underpcapkit/plus edge cases, on 3.9 and 3.14.With one key patched in (throwaway runner, not committed) and only that test run:
origin/main, keypcapkit/protocols/protocol.pyAttributeError: 'str' object has no attribute 'removesuffix'Key
pcapkit/vendor/gives the same results. No other 3.9+ API in the file: a pattern scan andast.parse(feature_version=(3, 8))find none, and the lines 3.8 never executes are docstrings and 3.8-safe calls. Narrow runs only;make testwas not run.Closes #1699