Skip to content

test(distros): Convert test_sysconfig.py from unittest to pytest#6510

Merged
blackboxsw merged 3 commits into
canonical:mainfrom
csemanish12:pytest-sysconfig-migration
Oct 17, 2025
Merged

test(distros): Convert test_sysconfig.py from unittest to pytest#6510
blackboxsw merged 3 commits into
canonical:mainfrom
csemanish12:pytest-sysconfig-migration

Conversation

@csemanish12
Copy link
Copy Markdown
Contributor

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

  • Removed TestCase inheritance
  • Converted self.assert* methods to bare assert statements
  • Maintained all original test functionality

Related: #6427

@csemanish12 csemanish12 changed the title test(distros): Convert test_sysconfig.py from unittest to pytest (#6504) test(distros): Convert test_sysconfig.py from unittest to pytest Oct 14, 2025
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 @csemanish12 for the contributions to cloud-init project health!
One minor suggestion as I don't think we need to be concerned with python 2.6 anymore.

self.assertTrue(
regexp.search(text),
msg="%s must match %s!" % (text, regexp.pattern),
assert regexp.search(text), "%s must match %s!" % (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I actually think we can drop this whole method assertRegMatches now as it's unused.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

agreed. the method is not used anymore. i have removed it.

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

  - Removed TestCase inheritance
  - Converted self.assert* methods to bare assert statements
  - Maintained all original test functionality

  Related: canonical#6427
@csemanish12 csemanish12 force-pushed the pytest-sysconfig-migration branch from 33abb8c to 4d44b85 Compare October 17, 2025 02:28
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.

LGTM! thanks again.

@blackboxsw blackboxsw merged commit bc96604 into canonical:main Oct 17, 2025
21 checks passed
blackboxsw pushed a commit to blackboxsw/cloud-init that referenced this pull request Dec 12, 2025
…onical#6510)

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

- Removed TestCase inheritance and unused py 2.6 method
- Converted self.assert* methods to bare assert statements
- Maintained all original test functionality

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

- Removed TestCase inheritance and unused py 2.6 method
- Converted self.assert* methods to bare assert statements
- 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