Skip to content

test: add coverage for download_url and tarball round-trip in utils.py#391

Merged
bigcat88 merged 1 commit intomainfrom
test/utils-coverage
Mar 27, 2026
Merged

test: add coverage for download_url and tarball round-trip in utils.py#391
bigcat88 merged 1 commit intomainfrom
test/utils-coverage

Conversation

@bigcat88
Copy link
Copy Markdown
Contributor

Two tests for the non-trivial logic in utils.py.

test_writes_file exercises the full download_url pipeline with a mocked HTTP response. The function monkey-patches response.raw.read via functools.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_extract does a real filesystem round-trip through create_tarball and extract_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-dependent extractall, and the shutil.move rename. Rich Live display is mocked out since both functions have a latent NameError when show_progress=False (progress_table is only defined inside the if show_progress block).

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 27, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bigcat88 bigcat88 merged commit 4625713 into main Mar 27, 2026
8 checks passed
@bigcat88 bigcat88 deleted the test/utils-coverage branch March 27, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant