Skip to content

Expand unit coverage for untested output and volumetric parser branches#148

Merged
jan-janssen merged 2 commits into
mainfrom
copilot/extend-unit-test-coverage
May 26, 2026
Merged

Expand unit coverage for untested output and volumetric parser branches#148
jan-janssen merged 2 commits into
mainfrom
copilot/extend-unit-test-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

This PR increases unit-test line coverage by targeting previously unexecuted control-flow paths in VASP output parsing. It adds focused branch tests where coverage was lowest, especially around fallback/error handling and structure-index remapping.

  • Output parser branch coverage (tests/unit/vasp/test_output_branches.py)

    • Adds tests for parse_vasp_output paths that were not exercised:
      • VaspCollectError re-raise behavior
      • CONTCAR -> POSCAR structure fallback
      • explicit sorted_indices handling
    • Adds tests for get_final_structure_from_file branches:
      • vasp_sorter(structure) path when indices are omitted
      • non-ase.Atoms structure path via get_parent_symbols
  • Volumetric parser branch coverage (tests/unit/vasp/test_volumetric_data_branches.py)

    • Adds tests for VaspVolumetricData.from_file fallback behavior:
      • _read_vol_data failure -> _read_vol_data_old fallback
      • hard failure when both parsers fail
    • Adds tests for warning/empty/corrupt paths:
      • empty file handling in _read_vol_data_old
      • missing-grid/corrupt parsing in _read_vol_data
    • Adds tests for POTCAR species fallback and to_dict() inclusion of diff data
with patch(
    "vaspparser.vasp.output.get_final_structure_from_file",
    side_effect=[OSError("contcar fail"), structure, IOError("ignore")],
):
    result = parse_vasp_output(
        working_directory=tmpdir,
        sorted_indices=[1, 0],
        output_parser_class=_ParserCollects,
    )

Copilot AI and others added 2 commits May 26, 2026 03:10
Agent-Logs-Url: https://github.com/pyiron/vaspparser/sessions/a9e0226e-b936-4290-8d61-4f51d518f460

Co-authored-by: jan-janssen <3854739+jan-janssen@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.91%. Comparing base (593882f) to head (fcf07ce).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #148      +/-   ##
==========================================
+ Coverage   91.89%   92.91%   +1.01%     
==========================================
  Files          14       14              
  Lines        2753     2753              
==========================================
+ Hits         2530     2558      +28     
+ Misses        223      195      -28     

☔ 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.

@jan-janssen jan-janssen merged commit 375ab74 into main May 26, 2026
19 checks passed
@jan-janssen jan-janssen deleted the copilot/extend-unit-test-coverage branch May 26, 2026 03:21
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