Skip to content

test: add pytest coverage for rs2gp pure helpers (measures, events, timing) - #11

Merged
OmikronApex merged 1 commit into
mainfrom
chore/add-basic-tests
Jul 8, 2026
Merged

test: add pytest coverage for rs2gp pure helpers (measures, events, timing)#11
OmikronApex merged 1 commit into
mainfrom
chore/add-basic-tests

Conversation

@OmikronApex

@OmikronApex OmikronApex commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Twenty-seventh repo from the org test-coverage audit. rs2gp.py (the RS-to-GuitarPro-5 converter) imports two dependencies at module top level: guitarpro (PyGuitarPro, a real pip package - pinned in the new requirements.txt) and song.arrangement_string_count (a host-provided lib module this plugin repo does not ship). A conftest stub supplies just that one symbol so the module imports standalone in CI, without touching the GP5 binary-writing path itself.

14 pytest tests:

  • _parse_measures: empty input, grouping by measure marker, BPM estimation from beat interval, last-measure end-time extrapolation, single-beat trailing measure reuses the prior measure's duration
  • _fallback_measure: default and custom song length
  • _note_dict: carries declared fields, defaults missing effect flags to False
  • _merge_events: sorts notes+chords by time, skips high_density chords
  • _used_string_indices: covers both standalone notes and chord members
  • _quantize_sixteenth: snaps event time to the nearest 32nd-note subdivision
  • _decompose_sixteenths / _dur_sixteenths: zero-count yields a whole rest, round-trip for common counts (1-33), dotted-duration multiplier

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Added a required runtime dependency for Guitar Pro file conversion support.
    • Improved test setup so the project can run in standalone CI environments.
  • Tests

    • Added coverage for key helper behavior, including measure parsing, event merging, string usage detection, quantization, and duration handling.

…iming)

rs2gp.py imports the host lib module 'song' at top level; a
conftest stub supplies arrangement_string_count so the module -
and the deterministic helpers under test - can be imported
standalone. requirements.txt pins PyGuitarPro since guitarpro.
Duration objects are exercised directly by the sixteenth-note
decomposition tests (real dependency, no need to stub it).

Covers measure parsing (grouping, BPM estimation, end-time
extrapolation), note/chord event merging + sort + high-density
chord skipping, used-string-index collection, sixteenth-note
quantization, and duration decompose/re-measure round-trips.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 343c71a9-e835-4496-91cf-e45fdae6b21a

📥 Commits

Reviewing files that changed from the base of the PR and between 8eecf04 and 9b44061.

📒 Files selected for processing (3)
  • requirements.txt
  • tests/conftest.py
  • tests/test_rs2gp_helpers.py

📝 Walkthrough

Walkthrough

This PR adds a PyGuitarPro dependency to requirements.txt, updates tests/conftest.py to configure sys.path and stub a song module, and introduces tests/test_rs2gp_helpers.py containing unit tests for several internal helper functions in rs2gp.py.

Changes

rs2gp Test Enablement

Layer / File(s) Summary
Dependency and test bootstrap
requirements.txt, tests/conftest.py
Adds PyGuitarPro>=0.11 to requirements.txt and configures conftest.py to prepend the repo root to sys.path and stub the song module with arrangement_string_count for standalone imports.
Helper function tests
tests/test_rs2gp_helpers.py
New test module validates _parse_measures, _fallback_measure, _note_dict, _merge_events, _used_string_indices, _quantize_sixteenth, _decompose_sixteenths, and _dur_sixteenths behavior with deterministic inputs.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: added pytest coverage for rs2gp helper functions and timing logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-basic-tests

Comment @coderabbitai help to get the list of available commands.

@OmikronApex
OmikronApex merged commit 1285844 into main Jul 8, 2026
3 checks passed
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.

1 participant