Skip to content

Refactor all tests to pytest style#139

Merged
joanise merged 3 commits intomainfrom
dev.ej/pytest-assertions
May 1, 2026
Merged

Refactor all tests to pytest style#139
joanise merged 3 commits intomainfrom
dev.ej/pytest-assertions

Conversation

@joanise
Copy link
Copy Markdown
Member

@joanise joanise commented May 1, 2026

PR Goal?

100% conversion to pytest. We no longer use TestCase at all, it's all pytest-style cases and fixtures.

How to test?

Compare running pytest in this branch and the parent branch.

Confidence?

high

Related PRs?

EveryVoiceTTS/EveryVoice#794

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented May 1, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  fs2/tests/test_writing_callbacks.py  80% smaller
  fs2/tests/test_chunking.py  72% smaller
  fs2/tests/test_loading.py  62% smaller
  fs2/tests/test_cli.py  52% smaller

@joanise
Copy link
Copy Markdown
Member Author

joanise commented May 1, 2026

Note: I will clean up the commit history before merging.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.88%. Comparing base (5840db6) to head (0a95bb8).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #139   +/-   ##
=======================================
  Coverage   47.88%   47.88%           
=======================================
  Files          27       27           
  Lines        1988     1988           
  Branches      225      225           
=======================================
  Hits          952      952           
  Misses       1000     1000           
  Partials       36       36           

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

Base automatically changed from dev.ej/full-pytest to main May 1, 2026 19:00
Copy link
Copy Markdown
Member

@roedoejet roedoejet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually find

self.assertTrue((output_dir / "one--S1--L1--ckpt=77--v_ckpt=10--pred.wav").exists())

more readable than since assertTrue let's me know I'm not scanning for an equal sign or something, and for long statements like this that contain = it feels more readable to use the unittest syntax. That said, I don't really mind and am happy to approve.

assert (output_dir / "one--S1--L1--ckpt=77--v_ckpt=10--pred.wav").exists()

joanise added 3 commits May 1, 2026 15:29
Squash of:
 - refactor(tests): replace all one-line self.assertTrue(x) by assert x
 - refactor(tests): replace all one-liner self.assertIn(a,b) by assert a in b
 - refactor(tests): replace assertEqual by assert == with a safe regex
 - refactor(tests): replace all remaining self.assert* by assert
 - all pure pytest assertions
 - remove TestCase
 - use fixtures
@joanise joanise force-pushed the dev.ej/pytest-assertions branch from 2606a33 to 0a95bb8 Compare May 1, 2026 19:31
@joanise
Copy link
Copy Markdown
Member Author

joanise commented May 1, 2026

About readability, I agree some pytest-style asserts are less legible, like the regex one and possibly this example, but in order to remove TestSuite completely and embrace pytest fixtures, all self.assert... assertions have to be rewritten.

@joanise joanise merged commit 0a95bb8 into main May 1, 2026
7 checks passed
@joanise joanise deleted the dev.ej/pytest-assertions branch May 1, 2026 19:53
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