Repository navigation
fix(client): pick the right path level for the dataset in get_local_hierarchy - #359
Merged
Merged
Conversation
…ierarchy
`_get_dest_path` nests a grouped file one directory deeper than an
ungrouped one:
downloads/<client>/<dataset>/<group>/<name> # has a group
downloads/<client>/<dataset>/<name> # no group
so the dataset is `parts[-3]` in the first case and `parts[-2]` in the
second. The ternary had them the other way round:
dataset = parts[-2] if has_group else parts[-3]
Every grouped file was keyed under its group name and every ungrouped
one under the client name, so `get_local_hierarchy` returned
`{"FTP": {"DC": {...}}}` instead of `{"FTP": {"sinan": {"DC": {...}}}}`.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #359 +/- ##
=======================================
Coverage ? 97.02%
=======================================
Files ? 180
Lines ? 22731
Branches ? 0
=======================================
Hits ? 22054
Misses ? 677
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
luabida
approved these changes
Sep 30, 2026
devgtv
added a commit
to devgtv/PySUS
that referenced
this pull request
Sep 30, 2026
Resolves the conflict with AlertaDengue#359 (already merged), which appends test classes to the same two files. The two fixes touch different regions of pysus/api/client.py and merge cleanly there. pysus/tests/api/test_client.py conflicted because AlertaDengue#358 and AlertaDengue#359 both append at end of file. Beyond concatenating them, this fixes two problems that AlertaDengue#359 introduced when it merged: - It defined a second `TestGetLocalHierarchy`, shadowing the existing class of the same name, so `test_get_local_hierarchy_all_branches` silently stopped being collected. It is now `TestGetLocalHierarchyDatasetLevel` and both classes run (51 tests in this file, up from 46). - That existing test asserted the *buggy* output of AlertaDengue#359: it expected a grouped file under its group name (`ftp_dict["DC"]`) and an ungrouped one under the client name (`ftp_dict["ftp"]`). Its assertions are updated to the corrected shape, and tightened: the old ones happened to pass partly by coincidence, so it now also pins down the directory record, the ungrouped bucket, and that "DC", "ftp" and "short" are not dataset keys.
|
🎉 This PR is included in version 2.11.4 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Summary
_get_dest_path(pysus/api/client.py:349) nests a grouped file one directory deeper than an ungrouped one:so the dataset is
parts[-3]in the first case andparts[-2]in the second. The ternary had them the other way round:Impact
Every grouped file was keyed under its group name and every ungrouped one under the client name, so
get_local_hierarchyreturned{"FTP": {"DC": {"DC": [...]}, "ftp": {"": [...]}}}instead of
{"FTP": {"sinan": {"DC": [...], "": [...]}}}The documented return shape is
{client: {dataset: {group: [files]}}}— neither the dataset nor the group level was correct.This is the second half of the
get_local_hierarchybreakage; the other half is #358 (groupwas never persisted, sohas_groupwas alwaysFalseand every file landed on the client name). Both are needed for a correct tree.Tests
Added 4 tests covering a grouped file, an ungrouped file, both shapes sharing one dataset, and two clients whose names must not be mistaken for datasets. All 4 fail against the previous code.
1736 passed, 6 skippedblackandisortclean