=== Juesto is now known as Juest | ||
=== meetingology` is now known as meetingology | ||
minimal | A question about mocking, how do I mock a function that's in a __init__.py file? I'm trying to mock the add_user function | 17:50 |
---|---|---|
minimal | I've tried @mock.patch("cloudinit.distros.__init__.add_user", return_value=False) | 17:51 |
minimal | if I do @mock.patch("cloudinit.distros.alpine.add_user", return_value=False) that will work ok | 17:53 |
blackboxsw | minimal: thanks for the updates last week on https://github.com/canonical/cloud-init/pull/5355. I'm going through this review now and will attempt to get up a couple of unittests to round out your approach there. Per your mock question and add_user, shouldn't you be mocking cloudinit.distros.Distro.add_user not cloudinit.distros.__init__.add_user? | 17:59 |
-ubottu:#cloud-init- Pull 5355 in canonical/cloud-init "fix: cc_user_groups incorrectly assumes 'useradd' never locks password field" [Open] | 17:59 | |
minimal | blackboxsw: I've written some more BSD tests locally and am working on some snappy-related tests. Also intend to rebase the PR shortly | 18:00 |
blackboxsw | Excellent minimal. I'm going through existing unit test coverage and will raise questions here if I start writing up supplemental tests to make sure I'm not doing work you are already addressing. One minor comment on your PR that I have already https://github.com/canonical/cloud-init/pull/5355#discussion_r1731599452 while you are touching that PR | 18:02 |
-ubottu:#cloud-init- Pull 5355 in canonical/cloud-init "fix: cc_user_groups incorrectly assumes 'useradd' never locks password field" [Open] | 18:02 | |
blackboxsw | thx for the var renames, makes it easier to reason about that code in add_user | 18:02 |
minimal | blackboxsw: seeming some strange testcase behaviour, 2 *existing* tests in tests/unittests/distro/test_create_user.py start failing whenever I add a new testfile (not testcases!) in same directory but pass fine when I remove the new testfile. That doesn't make sense to me. | 22:10 |
minimal | the same 2 tests every time: TestCreateUser.test_create_groups_with_dict_deprecated and TestCreateUser.test_explicit_sudo_false | 22:11 |
minimal | they're both failing with asserts related to deprecation caplog | 22:19 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!