Skip to content

test: Convert test_apt_conf_v1.py from unittest to pytest#6522

Closed
GautamThorani wants to merge 1 commit into
canonical:mainfrom
GautamThorani:convert-apt-conf-v1-to-pytest
Closed

test: Convert test_apt_conf_v1.py from unittest to pytest#6522
GautamThorani wants to merge 1 commit into
canonical:mainfrom
GautamThorani:convert-apt-conf-v1-to-pytest

Conversation

@GautamThorani
Copy link
Copy Markdown
Contributor

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

  • Removed TestCase inheritance and replaced with pytest fixtures
  • Converted self.assert* methods to bare assert statements
  • Used tmpdir fixture for temporary file handling instead of manual setup/teardown
  • Maintained all original test functionality
  • Followed cloud-init pytest guidelines

Related: #6427

- Remove unittest.TestCase inheritance
- Use pytest fixtures (tmpdir) instead of setUp/tearDown
- Convert self.assert* methods to bare assert statements
- Follow cloud-init pytest guidelines
- No functional changes, only test framework migration
@blackboxsw
Copy link
Copy Markdown
Collaborator

@GautamThorani thank you so much for presenting this PR and improving cloud-init. Unfortunately I think this is a duplicate of #6520 which seems to have arrived just before your PR. This effort is challenging to deal with in parallel without occasional duplication as multiple devs are touching this space at the same time :/.

@blackboxsw blackboxsw closed this Oct 21, 2025
@blackboxsw
Copy link
Copy Markdown
Collaborator

Additional note: an additional boon to avoid duplication in testing in #6250 is the use of pytest fixtures too.

@GautamThorani GautamThorani deleted the convert-apt-conf-v1-to-pytest branch October 21, 2025 18:44
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