Skip to content

Fix tests and Lint/Ruff#4

Merged
mscuthbert merged 28 commits into
masterfrom
ruff
May 26, 2026
Merged

Fix tests and Lint/Ruff#4
mscuthbert merged 28 commits into
masterfrom
ruff

Conversation

@mscuthbert

@mscuthbert mscuthbert commented May 26, 2026

Copy link
Copy Markdown
Member

Make it feel more like an up-to-date project.

  • All doc tests pass
  • All unittests pass (except TestExternal/TestSlow etc.)
  • Line widths
  • Quote style
  • Correct == True and == None etc.
  • Fix short/confusing variable names
  • Make it so the UX does not shout in debug code and encourages users, never mocking
  • Add CI tests
  • Standardize copyright etc. (done on Music21 a while back, but we hadn't done it here)

mscuthbert and others added 28 commits May 25, 2026 13:31
Adds [tool.ruff] config mirroring music21's flake8-quotes settings
(inline/multiline/docstring all single) and applies ruff --fix across
music21_tools/ and tools/ — 752 quote fixes in 17 files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copies .editorconfig and .pylintrc verbatim from music21base.
Applies ruff check --fix (27 fixes across 7 files: bare except,
not-in operator, dict.get fallthrough, etc.).

Restores `harmony` and `meter` imports in theoryAnalyzer.py that
ruff stripped as unused — they're used in doctests, which ruff
can't see.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
211 fixes across 12 files, all autofixable in preview mode.
No test regressions (127 passing / 22 failing, unchanged).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 fixes via ruff --unsafe-fixes across 9 files; transforms
`x == True` → `x` and `x == False` → `not x`. No regressions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces ALL-CAPS shouting in print statements and tkinter UI labels
with normal sentence case across audioSearchDemos and a few stragglers.
Rewrites lines that mocked or laughed at the user — "YOU LOSE!! HAHAHAHA",
"YOU ARE VERY SLOW!!! PLAY FASTER NEXT TIME!", "LOSER", etc. — into neutral
phrasing. MIDI constants (NOTE_ON, END_OF_TRACK) and template tokens
(SCOREGOESHERE) left alone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- .github/workflows/ci.yml runs ruff + pytest on Python 3.11-3.14 for
  pushes/PRs to master.
- conftest.py filters TestExternal/TestSlow classes during pytest
  collection (matches music21's pytest plugin convention).
- pyproject.toml bakes --doctest-modules, python_files='*.py', and
  testpaths='music21_tools' into pytest config so `uv run pytest` alone
  does the full sweep.
- Renamed module-level testFoo helpers that weren't actually tests
  (demo*, runAll); aug30.py's test() → demo() + new TestExternal wrapper
  so the .show() call doesn't fire during routine collection.
- README's "Running the tests" section trimmed to the essentials.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- ci.yml: trigger on PRs only (no push), and use actions/setup-python@v5
  to provide the interpreter instead of `uv python install` so uv reuses
  GitHub's cached Python toolchain.
- medren.py: collapse `isinstance(x, (Mensuration, notation.Divisione))`
  to `isinstance(x, MedievalMeter)` (their shared parent) in the two
  spots where both subclasses were checked together.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Therefore Capua's test needs to be split.
@mscuthbert mscuthbert merged commit d943a1d into master May 26, 2026
4 checks passed
@mscuthbert mscuthbert deleted the ruff branch May 26, 2026 08:34
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