Skip to content

Refactor a lot of test assertions to pytest style#794

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

Refactor a lot of test assertions to pytest style#794
joanise merged 4 commits intomainfrom
dev.ej/pytest-assertions

Conversation

@joanise
Copy link
Copy Markdown
Member

@joanise joanise commented May 1, 2026

PR Goal?

Moving further along in the pytest conversion, this PR takes advantage of the nicer assertions and fixtures that pytest provides.

The idea going forward is to always write pytest-style tests, with assert <expr> everywhere, and no longer use TestCase at all. This PR does not go 100% there, but it moves significantly in that direction. For the submodules, however, it's a 100% completed conversion.

Feedback sought?

sanity checking I guess. It's a long diff, but it only touches tests files.

Priority?

normal

How to test?

  • look at CI results
  • look at coverage, it should not drop since the refactored tests are still the same
  • manually: compare running pytest in the parent branch and running pytest in this one.

Confidence?

high

Version change?

no

Related PRs?

EveryVoiceTTS/wav2vec2aligner#30
EveryVoiceTTS/FastSpeech2_lightning#139

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented May 1, 2026

@joanise
Copy link
Copy Markdown
Member Author

joanise commented May 1, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

CLI load time: 0:00.32
Pull Request HEAD: d095deebcb7516ead5c22b37ae333a8384440cc0
Imports that take more than 0.1 s:
import time: self [us] | cumulative | imported package
import time:      1797 |     194775 | everyvoice.cli

@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 83.41%. Comparing base (1b85524) to head (d095dee).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #794   +/-   ##
=======================================
  Coverage   83.41%   83.41%           
=======================================
  Files          47       47           
  Lines        4203     4203           
  Branches      615      615           
=======================================
  Hits         3506     3506           
  Misses        567      567           
  Partials      130      130           

☔ 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 18:59
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.

lgtm - thanks @joanise !

joanise added 4 commits May 1, 2026 15:36
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): more assert conversions that can be done automatically
 - test: allow older pytest (>7, which requires pytest-subtests separately)
@joanise joanise force-pushed the dev.ej/pytest-assertions branch from 2b8975f to d095dee Compare May 1, 2026 19:39
Comment thread everyvoice/tests/test_cli.py Dismissed
@joanise joanise merged commit 8625bdc into main May 1, 2026
13 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.

3 participants