test: add coverage for download_url and tarball round-trip in utils.py#391
Merged
test: add coverage for download_url and tarball round-trip in utils.py#391
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #391 +/- ##
==========================================
+ Coverage 72.59% 74.22% +1.63%
==========================================
Files 33 33
Lines 3915 3915
==========================================
+ Hits 2842 2906 +64
+ Misses 1073 1009 -64 see 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Two tests for the non-trivial logic in utils.py.
test_writes_fileexercises the fulldownload_urlpipeline with a mocked HTTP response. The function monkey-patchesresponse.raw.readviafunctools.partial(..., decode_content=True), so the test uses a custom_FakeRaw(BytesIO)subclass that accepts that kwarg — a plain BytesIO would blow up. Verifies the file lands on disk with correct contents.test_create_and_extractdoes a real filesystem round-trip throughcreate_tarballandextract_tarball: creates a directory tree, archives it, extracts to a new location, and verifies file contents survive. This covers the path arithmetic (inPath.relative_to(cwd),inPath.with_name(old_name)), the CWD-dependentextractall, and theshutil.moverename. RichLivedisplay is mocked out since both functions have a latentNameErrorwhenshow_progress=False(progress_tableis only defined inside theif show_progressblock).