{{ message }}
Convert Unittest testcases with setup/teardown to fixtures#1240
Merged
Conversation
63185e8 to
c06b041
Compare
There was a problem hiding this comment.
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
Member
Author
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.

This PR follows up on #1241 to unwrap remaining
unittest.TestCases to use Pytest fixtures.