-
Notifications
You must be signed in to change notification settings - Fork 340
Upgrade from unittest to pytest #535
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
|
|
The correct number is 131 reported by unittest. PyTest runs |
UnitTest is reading only If you run each module test case explicitly even after using unittest: You will see again 181 Test cases if you count all test cases from above commands output. |
|
@cclauss And if nothing runs inside test_cloud module then the second thing we want to do is Ref: pytest-doc |
b9a7465 to
7a73899
Compare
7a73899 to
3be3ede
Compare
Applied
ruff check --select=PT --fix --unsafe-fixesto modernize test assertions from unittest to pytest style.Changes
Converted 278 PT009 violations: unittest assertions → pytest assertions
self.assertEqual(a, b)→assert a == bself.assertIn(a, b)→assert a in bself.assertRegex(text, pattern)→assert re.search(pattern, text)Converted 19 PT027 violations: unittest raises → pytest context managers
self.assertRaises(ValueError, func, args)→with pytest.raises(ValueError): func(args)Configuration: Removed PT009 and PT027 from ignore list in
pyproject.tomlImports: Added
pytestto test files andretotest_cloud.py(required for convertedassertRegexcalls)4 PT011 warnings remain (pytest.raises too broad) - these are not auto-fixable and require manual match parameters.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.