Skip to content

test(sources): Convert test_common.py from unittest to pytest#6512

Merged
blackboxsw merged 1 commit into
canonical:mainfrom
Pneha1234:pytest-convert-test-common
Oct 16, 2025
Merged

test(sources): Convert test_common.py from unittest to pytest#6512
blackboxsw merged 1 commit into
canonical:mainfrom
Pneha1234:pytest-convert-test-common

Conversation

@Pneha1234
Copy link
Copy Markdown
Contributor

Refactored tests/unittests/sources/test_common.py to use pytest instead of unittest.TestCase as part of the pytest migration effort.

  • Removed TestCase inheritance from both test classes
  • Renamed ExpectedDataSources to TestExpectedDataSources for pytest discovery
  • Converted self.assertEqual() methods to bare assert statements
  • Converted self.assertTrue() to assert statement
  • Converted self.assertNotEqual() to assert statement
  • Converted self.assertIsNotNone() to assert statement
  • Removed unused test_helpers import
  • Maintained all original test functionality

Related: #6427

Refactored tests/unittests/sources/test_common.py to use pytest instead of unittest.TestCase as part of the pytest migration effort.

- Removed TestCase inheritance from both test classes

- Renamed ExpectedDataSources to TestExpectedDataSources for pytest discovery

- Converted self.assertEqual() methods to bare assert statements

- Converted self.assertTrue() to assert statement

- Converted self.assertNotEqual() to assert statement

- Converted self.assertIsNotNone() to assert statement

- Removed unused test_helpers import

- Maintained all original test functionality

Related: canonical#6427
Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you much for this @Pneha1234. Let's convert all tests we can from test_helpers.TestCase -> pytest :). Thank you thank you!

@blackboxsw blackboxsw merged commit 92421c1 into canonical:main Oct 16, 2025
21 checks passed
blackboxsw pushed a commit to blackboxsw/cloud-init that referenced this pull request Dec 12, 2025
…cal#6512)

Refactored tests/unittests/sources/test_common.py to use pytest instead of
unittest.TestCase as part of the pytest migration effort.

- Removed TestCase inheritance from both test classes
- Renamed ExpectedDataSources to TestExpectedDataSources for pytest discovery
- Converted self.assertEqual() methods to bare assert statements
- Converted self.assertTrue() to assert statement
- Converted self.assertNotEqual() to assert statement
- Converted self.assertIsNotNone() to assert statement
- Removed unused test_helpers import
- Maintained all original test functionality

Related: canonical#6427
holmanb pushed a commit that referenced this pull request Dec 18, 2025
Refactored tests/unittests/sources/test_common.py to use pytest instead of
unittest.TestCase as part of the pytest migration effort.

- Removed TestCase inheritance from both test classes
- Renamed ExpectedDataSources to TestExpectedDataSources for pytest discovery
- Converted self.assertEqual() methods to bare assert statements
- Converted self.assertTrue() to assert statement
- Converted self.assertNotEqual() to assert statement
- Converted self.assertIsNotNone() to assert statement
- Removed unused test_helpers import
- Maintained all original test functionality

Related: #6427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants