-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
This task involves converting the tests within tests/unit_tests/test_cloud.py from unittest.TestCase-based tests to the pytest functional style.
Instructions for Copilot/Assignee:
- Remove TestCase Inheritance: Convert test classes inheriting from unittest.TestCase into regular Python classes or simply remove the classes and use standalone functions.
- Convert Assertions: Replace self.assertEqual(...), self.assertTrue(...), etc., with standard assert statements. pytest automatically handles assertion rewriting.
3.Refactor Setup/Teardown:
- Move setUp() methods to pytest.fixture functions.
- Move tearDown() methods to finalizers in fixtures using yield or addfinalizer.
- Use mocker instead or mock.patch or mock.call
5.Handle Exceptions: Replace self.assertRaises(...) with pytest.raises(...) as a context manager.
Acceptance criteria:
- no remaining self.assert*, mock.call or mock.patch uses
- no setUp or teadDown methods
- If common mocks are used for most tests in a class, ensure the test class has a common setup_mocks fixture
- Ensure proper format is applied by running
tox -e format - Run Tests: Ensure all tests with
tox -e pytestin the root directory - Semantic version PATCH value must be incremented in pycloudlib/VERSION
- Ensure all github workflows succeed
- The final squashed changset should be a single git commit which contains the footer 'Fixes GH-<issue_id>'
Copilot
Metadata
Metadata
Assignees
Labels
No labels