Repository navigation
Preserve empty child directories in ZIP and TAR archives - #205
fabiocaccamo merged 4 commits into
Conversation
|
The Codacy report flags three assertions in tests/test_archives.py (lines 52–54) under Bandit's "Avoid Use of Assert Statements" rule. These are pytest test assertions, following the existing test suite's style, rather than runtime validation in the library. Could this rule be excluded for tests/ in the Codacy configuration, or these test-only findings marked as false positives? I've left the assertions intact so pytest keeps its normal failure introspection. |
…linked ones as directories.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #205 +/- ##
=======================================
Coverage 98.59% 98.60%
=======================================
Files 13 13
Lines 854 858 +4
=======================================
+ Hits 842 846 +4
Misses 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # src/fsutil/archives.py
Describe your changes
Empty child directories disappear when a directory is archived with
create_zip_file()orcreate_tar_file()and then extracted. Both writers recurse through directory contents but only write file entries.Write an explicit entry for an empty child directory. Keep the existing contents-only layout for each input directory and the existing paths for files. The regression performs ZIP and TAR round trips with an empty directory, a nested empty directory and a nonempty sibling file.
Related issue
No matching issue or PR found. Both round-trip regressions fail on current main because the empty directories are missing after extraction. This is independent of the local-filename fix in #204.
Validation
Checklist before requesting a review
AI-assisted with OpenAI Codex, including investigation, implementation and verification.