-
Notifications
You must be signed in to change notification settings - Fork 460
Convert Unittest testcases with setup/teardown to fixtures #1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1240 +/- ##
=======================================
Coverage 92.05% 92.05%
=======================================
Files 27 27
Lines 4680 4680
=======================================
Hits 4308 4308
Misses 372 372
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
63185e8 to
c06b041
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modernizes the test suite by converting unittest.TestCase-based tests to plain pytest functions. The main changes include:
- Replacing setUp()/tearDown() methods with pytest fixtures
- Converting class-based tests to standalone functions
- Splitting files with multiple TestCase classes into separate modules
- Creating a new
tests/messages/frontend/package to organize frontend-related tests
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_util.py | Converted FixedOffsetTimezoneTestCase class to standalone test functions |
| tests/test_plural_rule_parser.py | New file containing plural rule parser tests extracted from test_plural.py |
| tests/test_plural.py | Removed PluralRuleParserTestCase, extracted tests to new file, converted TestNextTokenTestCase to functions |
| tests/test_numbers_parsing.py | New file containing number parsing tests extracted from test_numbers.py |
| tests/test_numbers_format_decimal.py | New file containing decimal formatting tests extracted from test_numbers.py |
| tests/test_numbers.py | Removed FormatDecimalTestCase and NumberParsingTestCase, kept only top-level test functions |
| tests/test_localedata.py | Converted MergeResolveTestCase to standalone test functions |
| tests/test_dates.py | Minor formatting adjustment (added blank line) |
| tests/messages/utils.py | Added Distribution class moved from test_frontend.py |
| tests/messages/test_pofile_write.py | New file containing write tests extracted from test_pofile.py |
| tests/messages/test_pofile_read.py | New file containing read tests extracted from test_pofile.py |
| tests/messages/test_pofile.py | Removed ReadPoTestCase and WritePoTestCase, kept utility test functions |
| tests/messages/test_mofile.py | Converted ReadMoTestCase and WriteMoTestCase to standalone functions with fixture |
| tests/messages/test_extract_python.py | New file containing Python extraction tests extracted from test_extract.py |
| tests/messages/test_extract.py | Removed ExtractPythonTestCase, kept ExtractTestCase tests as functions |
| tests/messages/test_checkers.py | Converted CheckersTestCase and TestPythonFormat to standalone test functions |
| tests/messages/test_catalog.py | Converted MessageTestCase and CatalogTestCase to standalone test functions |
| tests/messages/frontend/test_init.py | New file containing InitCatalog tests from test_frontend.py |
| tests/messages/frontend/test_extract.py | New file containing ExtractMessages tests from test_frontend.py |
| tests/messages/frontend/test_frontend.py | New file containing general frontend tests from test_frontend.py |
The refactoring is well-executed and follows pytest conventions. The tests maintain their original behavior while adopting a more modern and idiomatic pytest style.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c06b041 to
802382f
Compare
802382f to
b3fcb5b
Compare
This PR follows up on #1241 to unwrap remaining
unittest.TestCases to use Pytest fixtures.