Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 8, 2025

Overview

This PR adds comprehensive unit tests for the _get_storage_options_and_path function to address code-coverage regressions introduced in a recent branch. The function handles different input types (Path, UPath, and str) but these code paths were not being exercised by existing tests.

Problem

The _get_storage_options_and_path function in src/nested_pandas/nestedframe/io.py contains branches that test for Path and UPath types (lines 218-233), but these branches were not covered by any unit tests, leading to code-coverage regressions.

Solution

Added a new test function test__get_storage_options_and_path() that comprehensively exercises all input types and scenarios:

  • Path objects - Tests local file handling with pathlib.Path
  • UPath objects - Tests both local and remote file handling:
    • Local UPath instances (protocol: "" or "file")
    • Remote HTTP/HTTPS UPath instances (with FSSPEC_BLOCK_SIZE optimization)
    • Remote S3/GCS UPath instances (without block size override)
  • String arguments - Tests both local paths and remote URLs (HTTP, HTTPS, S3, GCS)
  • Invalid types - Tests proper TypeError handling for unsupported input types

Results

  • Code coverage improved from 82% to 91% for io.py
  • All previously uncovered branches in _get_storage_options_and_path are now tested
  • All tests pass (24/24, excluding 1 pre-existing test with network issues)
  • Code passes linting checks

Testing

The new test validates that:

  • Local paths (Path and UPath) return None for storage options
  • Remote HTTP/HTTPS UPath instances apply the optimized block size
  • Remote S3/GCS paths use appropriate storage options
  • Invalid input types raise TypeError as expected

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • nasa-irsa-euclid-q1.s3.us-east-1.amazonaws.com
    • Triggering command: python -m pytest tests/nested_pandas/nestedframe/test_io.py::test__transform_read_parquet_data_arg -v (dns block)
    • Triggering command: python -m pytest tests/nested_pandas/nestedframe/test_io.py -v --cov=src/nested_pandas/nestedframe/io --cov-report=term-missing --cov-report=html -x (dns block)
    • Triggering command: python -m pytest tests/nested_pandas/nestedframe/test_io.py --ignore=tests/nested_pandas/nestedframe/test_io.py::test__transform_read_parquet_data_arg --cov=src/nested_pandas/nestedframe/io --cov-report=term-missing (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This branch works but introduced code-coverage regressions because, it appears, the unit tests do not exercise paths that are Path or UPath. In _get_storage_options_and_path there are branches that test for these types and they don't get exercised. Add unit tests that exercise these cases.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 8, 2025 19:07
…cases

Co-authored-by: gitosaurus <6794831+gitosaurus@users.noreply.github.com>
Co-authored-by: gitosaurus <6794831+gitosaurus@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Add unit tests to improve coverage for Path and UPath Add unit tests for Path and UPath handling in _get_storage_options_and_path Oct 8, 2025
@Copilot Copilot AI requested a review from gitosaurus October 8, 2025 19:12
Copilot finished work on behalf of gitosaurus October 8, 2025 19:12
@gitosaurus gitosaurus marked this pull request as ready for review October 8, 2025 19:17
@gitosaurus gitosaurus merged commit 12eb93c into dtj-parquet-io Oct 8, 2025
1 check passed
@gitosaurus gitosaurus deleted the copilot/add-unit-tests-for-path-cases branch October 8, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants