Repository navigation
item.pyi: sync with item.pyx, add a test that they agree, refs #10021 - #10533
Open
Vinay-Kaushal wants to merge 1 commit into
Open
Vinay-Kaushal wants to merge 1 commit into
Vinay-Kaushal wants to merge 1 commit into
Conversation
…ckup#10021 The hand-maintained stub had drifted from the PropDictProperty table: - add missing properties: Item.target, ArchiveItem.command_line, ArchiveItem.recreate_command_line, ArchiveItem.cwd, Key.crypt_key, EncryptedKey.argon2_time_cost/argon2_memory_cost/argon2_parallelism/argon2_type - remove properties that do not exist: ArchiveItem.csize, Key.enc_key, Key.enc_hmac_key - use precise types instead of Any for ArchiveItem.recreate_args, recreate_partial_chunks and recreate_source_id - ManifestItem.archives is a dict with str keys, not Mapping[bytes, dict] - declare PropDictProperty The new test parses item.pyi and checks, for every PropDict subclass, that the stub declares exactly the PropDictProperty attributes of item.pyx and that the annotated types match their value_type, so they cannot drift apart again.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10533 +/- ##
==========================================
+ Coverage 89.32% 89.35% +0.02%
==========================================
Files 104 104
Lines 20079 20079
Branches 3152 3152
==========================================
+ Hits 17936 17941 +5
+ Misses 1484 1481 -3
+ Partials 659 657 -2 ☔ View full report in Codecov by Harness. |
This branch has not been deployed
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.
Description
Addresses point 3 of #10021 ("Keep
item.pyihonest"): add a test asserting that the hand-maintained stub and thePropDictPropertytable initem.pyxagree.The stub had already drifted, so this also syncs it:
Item.target,ArchiveItem.command_line,ArchiveItem.recreate_command_line,ArchiveItem.cwd,Key.crypt_key,EncryptedKey.argon2_time_cost/argon2_memory_cost/argon2_parallelism/argon2_typeArchiveItem.csize,Key.enc_key,Key.enc_hmac_keyAnyforArchiveItem.recreate_args,recreate_partial_chunksandrecreate_source_idManifestItem.archivesis adictwithstrkeys, notMapping[bytes, dict]PropDictProperty(imported by the test)The new test (
item_test.py::test_stub_matches_propdict_properties) parsesitem.pyiwithastand checks, for everyPropDictsubclass, that the stub declares exactly thePropDictPropertyattributes of the class, that getter and setter annotations agree and that the annotated base type matches the property'svalue_type. With the old stub it fails for all 5 classes.Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)item_test.pypasses,mypy --ignore-missing-imports,ruff check .andblack --checkare clean. Full suite: 3670 passed; the only failure (prune_cmd_test.py::test_prune[rule4-3-expected_indices4]) fails the same way on unmodifiedmasterin my environment, so it is unrelated.