canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.92k stars 871 forks source link

[enhancement]: adapt unittests to pytest: drop use of FilesystemMocking testcases #5760

Open blackboxsw opened 1 week ago

blackboxsw commented 1 week ago

Enhancement

Community involvement in any element of this work is encouraged as it it easy to work on individual unittests in parallel without risk of merge conflicts.

cloud-init upstream is looking to convert all of our existing unittests from python's builtin unittest module to pytest to take advantage of parametrization, fixtures and simpler asserts.

One aspect of the move toward pytest everywhere dropping the uses of FileSystemMockingTestCase from any existing unittests so we can delete this class definition.

To achieve that goal, we'll need to first convert all existing unittests which subclass FileSystemMockingTestCase to pytest, making use of pytests fixtures and common mocks where necessary.

Below is a list of current unittest modules which use FilesystemMockingTestCase which we would like to convert to pytest. If there is interest in working on any subset of these unittests, add a comment to this issue with the intended unittests being worked and we will ensure nobody else is actively working them.

An example of this work is presented by the following PRs: #5758, #5727, #5647, #4840 and #4244.

To aid in pytestifying existing unittests it is helpful to use the https://github.com/dannysepler/pytestify tool to automate the initial self.assert* conversions and exception handling quickly.

Aanchallllll commented 1 week ago

Hello, I would like to contribute, can I be assigned?

aciba90 commented 1 week ago

Please, @Aanchallllll, do so. As this item can and should be split in multiple PRs, I don't think it is needed to assign it to an individual person. Thanks for making cloud-init better.