refactor: Removed ImportTestCase in favor of ImportHelper#6680
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6680 +/- ##
==========================================
- Coverage 75.57% 74.45% -1.12%
==========================================
Files 162 162
Lines 20806 20806
Branches 3292 3292
==========================================
- Hits 15725 15492 -233
- Misses 4306 4563 +257
+ Partials 775 751 -24 🚀 New features to boost your workflow:
|
ImportTestCase in favor of PytestImportHelperImportTestCase in favor of ImportHelper
b50ca40 to
27604e3
Compare
ImportTestCase in favor of ImportHelperImportTestCase in favor of ImportHelper
043c48b to
9c8a977
Compare
9c8a977 to
0420bc0
Compare
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
There was a problem hiding this comment.
Pull request overview
grug see PR want remove ImportTestCase and move tests to ImportHelper + pytest style. this fit test harness cleanup work and help future logging overhaul by making importer tests more uniform.
Changes:
- delete
ImportTestCasealias and update helper inheritance to useImportHelperdirectly - refactor many plugin/import tests from
unittestpatterns (setUp,skipTest, decorators) to pytest patterns (setup_beets,pytest.skip,pytest.mark.skipif) - rename a bunch of test classes to
Test*names to match pytest discovery
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
beets/test/helper.py |
remove ImportTestCase alias; keep importer helpers centered on ImportHelper |
test/ui/test_ui_importer.py |
update terminal importer tests to inherit from renamed importer test class |
test/test_logging.py |
convert logging importer tests to ImportHelper and pytest lifecycle hooks |
test/test_importer.py |
replace ImportTestCase usage, convert skips to pytest, rename tests |
test/plugins/test_scrub.py |
convert scrub plugin import test to ImportHelper |
test/plugins/test_filefilter.py |
convert filefilter tests to ImportHelper and pytest setup |
test/plugins/test_replaygain.py |
convert replaygain tests off unittest patterns, use pytest skip/marks |
test/plugins/test_permissions.py |
convert permissions tests to ImportHelper and pytest skip |
test/plugins/test_keyfinder.py |
convert keyfinder test to ImportHelper |
test/plugins/test_chroma.py |
convert chroma test to ImportHelper |
Comments suppressed due to low confidence (1)
test/test_logging.py:243
- grug see docstring still say old class name
LoggingLevelTest. class renamed toTestLoggingLevel, so docstring now lie.
class TestConcurrentEvents(AsIsImporterMixin, ImportHelper):
"""Similar to LoggingLevelTest but lower-level and focused on multiple
events interaction. Since this is a bit heavy we don't do it in
LoggingLevelTest.
"""
0420bc0 to
4ee7102
Compare
4ee7102 to
d4d1fcb
Compare
| super().setUpClass() | ||
| @pytest.fixture(autouse=True, scope="class") | ||
| def _patch_dummy_module(self): | ||
| with patch.dict(sys.modules, {"beetsplug.dummy": DummyModule()}): |
There was a problem hiding this comment.
Or is this not possible using monkeypatch?
There was a problem hiding this comment.
It seems not possible. monkeypatch does not work on class scope
There was a problem hiding this comment.
This works but needs function scope instead of class scope.
@pytest.fixture(autouse=True)
def _patch_dummy_module(self, monkeypatch):
monkeypatch.setitem(sys.modules, "beetsplug.dummy", DummyModule())
Description
This PR removes
ImportTestCaseand replaces all occurrences withImportHelper+pytest.This touches:
test_scrubtest_filefiltertest_replaygaintest_chromatest_importTODOs:
ChangelogNot needed as this is an internal refactor onlyThis is related to the multi-step efforts to improve logging in beets #6553