Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Missing test coverage for the _extract_with_config() function in cli_extract.py. This function handles config-based CDF extraction but was only tested at the library level, not through the CLI interface.

Changes

  • New test file tests/test_cli_extract.py with 17 tests covering:
    • Config-based extraction to CSV (column mapping, auto-detect job, invalid job, max records, specific variables)
    • Raw extraction without config to CSV and Parquet
    • Config-based extraction to Parquet
    • Append mode for both formats
    • Filename-to-column extraction

Example test

def test_extract_with_config_basic_csv(self, cli_runner, imap_cdf_file, tmp_path):
    config_file = tmp_path / "crump_config.yml"
    config_file.write_text("""
jobs:
  imap_mag:
    target_table: mag_data
    id_mapping:
      epoch: timestamp
    columns:
      vectors_x: vector_x
""")
    
    result = cli_runner.invoke(extract, [
        str(imap_cdf_file),
        "--config", str(config_file),
        "--job", "imap_mag",
    ])
    
    assert result.exit_code == 0
    # Verify transformed column names in output CSV
Original prompt

This section details on the original issue you should resolve

<issue_title>Missing test coverage of _extract_with_config</issue_title>
<issue_description>- Add unit tests that exercises def _extract_with_config(...) function in the cli_extract.py file. This should pass a config file to the extract CLI command

  • Add tests that extract with and without config to a parquet file
  • check the tests pass, and if needed fix the code to amke them pass
  • make sure linting and syntax checkers pass
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: alastairtree <6273429+alastairtree@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for _extract_with_config function Add CLI test coverage for _extract_with_config Dec 10, 2025
Copilot AI requested a review from alastairtree December 10, 2025 21:43
@alastairtree alastairtree marked this pull request as ready for review December 10, 2025 21:45
@github-actions
Copy link

github-actions bot commented Dec 10, 2025

Test Results (Linux 3.14)

400 tests  +17   400 ✅ +17   37s ⏱️ +4s
  1 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit dbb8d46. ± Comparison against base commit 69f7819.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

Coverage report

This PR does not seem to contain any modification to coverable code.

@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.94%. Comparing base (69f7819) to head (dbb8d46).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
+ Coverage   84.78%   87.94%   +3.15%     
==========================================
  Files          17       17              
  Lines        2406     2406              
==========================================
+ Hits         2040     2116      +76     
+ Misses        366      290      -76     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alastairtree alastairtree merged commit 9af3b2d into main Dec 10, 2025
21 checks passed
@alastairtree alastairtree deleted the copilot/add-tests-extract-with-config branch December 10, 2025 21:55
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.

Missing test coverage of _extract_with_config

3 participants