Repository navigation
Get rid of unittest once and for all - #896
Merged
Merged
Conversation
Changed Files
|
Contributor
|
This was referenced Oct 14, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #896 +/- ##
=======================================
Coverage 85.25% 85.25%
=======================================
Files 51 51
Lines 4789 4789
Branches 712 712
=======================================
Hits 4083 4083
Misses 534 534
Partials 172 172 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
roedoejet
approved these changes
Oct 15, 2026
roedoejet
left a comment
Member
There was a problem hiding this comment.
I think you mean get rid of unittest* once and for all 😆 but yes, skimmed this and it looks all standard. tests pass on a freshly installed env on my mac.
Convert test_evaluation, test_symbol_mapping, test_subsample, test_wizard_helpers and test_utils from unittest.TestCase to pytest style; assertLogs in test_utils is replaced by caplog. Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
WizardTestBase no longer derives from TestCase, so its subclasses TestWizard and TestCustomG2p are converted in the same commit. TestG2p's setUp/tearDown become an autouse fixture that saves and restores AVAILABLE_G2P_ENGINES. Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
The subTest loops over model and config types become parametrized tests, with a make_model() helper replacing the duplicated FastSpeech2 and HiFiGAN construction in the two TestLoadingModel tests. Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
The assertLogs check in test_config_lock is replaced by caplog, cleared at the start of each fail_config_lock() call so that each check only sees its own log messages. assertAlmostEqual(places=4) becomes pytest.approx(abs=5e-5) to keep the same tolerance. Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
Also fix the TestDemoAppErros class name typo. The scripts are still run as `coverage run -p ../test-demo-app.py` by regression-test.sh; their __main__ blocks keep calling pytest.main(sys.argv). Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
The docstrings said to run test_demo_app_mix.py, which doesn't exist; prep-datasets.sh copies each script to ../test-demo-app.py relative to the regress directory, where regression-test.sh runs it. Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
We were using capture_stdout and capture_stderr extensively to compensate for the fact that unittest leaks a lot of output to screen. Pytest cleanly captures everything, so we no longer need to do that.
The test suite is now fully in pytest style; this local pygrep hook keeps unittest.TestCase from creeping back in. Refactoring done with the assistance of Claude Opus 5.5, fully human reviewed.
joanise
force-pushed
the
dev.ej/convert-to-pytest
branch
from
October 15, 2026 17:59
3f6c93e to
92b2147
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Goal?
Convert all out tests that are still based on
unittest.TestCaseto pytest.Fixes?
Gives us more of the benefits of using pytest.
Feedback sought?
Mostly rubber stamping, maybe sanity checking. This PR touches a lot of code, and the diff is very long, but it's just changing how we run tests, nothing in the real code.
Priority?
medium
Tests added?
only changes tests
How to test?
uv run pyteststill runs all the tests -- note that there are now 407 instead of 403 due to some tests having been refactored usingpytest.parametrizeConfidence?
high
Version change?
no
Related PRs?
EveryVoiceTTS/StyleTTS2#40
EveryVoiceTTS/FastSpeech2_lightning#170
Some of this refactoring was done with the assistance of Claude Opus 5.5, fully human reviewed.