Skip to content

Commit

Permalink
chore: clean up pytest warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Sep 19, 2024
1 parent 53857c8 commit 3a5ee6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
9 changes: 4 additions & 5 deletions tests/unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ def disable_setup_logging():
def mock_status_wrapper(mocker, tmpdir):
link_d = os.path.join(tmpdir, "link")
data_d = os.path.join(tmpdir, "data")
with mocker.patch(
mocker.patch(
"cloudinit.cmd.main.read_cfg_paths",
return_value=mock.Mock(get_cpath=lambda _: data_d),
), mocker.patch(
"cloudinit.cmd.main.os.path.normpath", return_value=link_d
):
yield Tmpdir(tmpdir, link_d, data_d)
)
mocker.patch("cloudinit.cmd.main.os.path.normpath", return_value=link_d)
yield Tmpdir(tmpdir, link_d, data_d)


class TestCLI:
Expand Down
20 changes: 10 additions & 10 deletions tests/unittests/test_ds_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ def test_ibmcloud_template_userdata_in_provisioning(self):
m for m in data["mocks"] if m["name"] == "is_ibm_provisioning"
][0]
isprov_m["ret"] = shell_true
return self._check_via_dict(data, RC_NOT_FOUND)
self._check_via_dict(data, RC_NOT_FOUND)

def test_ibmcloud_template_userdata(self):
"""Template provisioned with user-data first boot.
Expand All @@ -770,7 +770,7 @@ def test_ibmcloud_template_no_userdata_in_provisioning(self):
data["mocks"].append(
{"name": "is_ibm_provisioning", "ret": shell_true}
)
return self._check_via_dict(data, RC_NOT_FOUND)
self._check_via_dict(data, RC_NOT_FOUND)

def test_ibmcloud_template_no_userdata(self):
"""Template provisioned with no user-data first boot.
Expand Down Expand Up @@ -1179,7 +1179,7 @@ def test_vmware_on_vmware_open_vm_tools_64(self):
open64 = "usr/lib64/open-vm-tools/plugins/vmsvc/libdeployPkgPlugin.so"
cust64["files"][open64] = cust64["files"][p32]
del cust64["files"][p32]
return self._check_via_dict(
self._check_via_dict(
cust64, RC_FOUND, dslist=[cust64.get("ds"), DS_NONE]
)

Expand All @@ -1194,7 +1194,7 @@ def test_vmware_on_vmware_open_vm_tools_x86_64_linux_gnu(self):
)
cust64["files"][x86] = cust64["files"][p32]
del cust64["files"][p32]
return self._check_via_dict(
self._check_via_dict(
cust64, RC_FOUND, dslist=[cust64.get("ds"), DS_NONE]
)

Expand All @@ -1209,7 +1209,7 @@ def test_vmware_on_vmware_open_vm_tools_aarch64_linux_gnu(self):
)
cust64["files"][aarch64] = cust64["files"][p32]
del cust64["files"][p32]
return self._check_via_dict(
self._check_via_dict(
cust64, RC_FOUND, dslist=[cust64.get("ds"), DS_NONE]
)

Expand All @@ -1224,7 +1224,7 @@ def test_vmware_on_vmware_open_vm_tools_i386_linux_gnu(self):
)
cust64["files"][i386] = cust64["files"][p32]
del cust64["files"][p32]
return self._check_via_dict(
self._check_via_dict(
cust64, RC_FOUND, dslist=[cust64.get("ds"), DS_NONE]
)

Expand Down Expand Up @@ -1400,7 +1400,7 @@ def test_no_userprofile(self):
"RET": "\r\n",
},
)
return self._check_via_dict(data, RC_NOT_FOUND)
self._check_via_dict(data, RC_NOT_FOUND)

def test_no_cloudinitdir_in_userprofile(self):
"""Negative test by not finding %USERPROFILE%/.cloud-init."""
Expand All @@ -1413,7 +1413,7 @@ def test_no_cloudinitdir_in_userprofile(self):
"RET": userprofile,
},
)
return self._check_via_dict(data, RC_NOT_FOUND)
self._check_via_dict(data, RC_NOT_FOUND)

def test_empty_cloudinitdir(self):
"""Negative test by lack of host filesystem mount points."""
Expand All @@ -1428,7 +1428,7 @@ def test_empty_cloudinitdir(self):
)
cloudinitdir = os.path.join(userprofile, ".cloud-init")
os.mkdir(cloudinitdir)
return self._check_via_dict(data, RC_NOT_FOUND)
self._check_via_dict(data, RC_NOT_FOUND)

def test_found_fail_due_instance_name_parsing(self):
"""WSL datasource detection fail due parsing error even though the file
Expand Down Expand Up @@ -1524,7 +1524,7 @@ def test_found_via_userdata(self):
Path(filename).unlink()

# Until there is none, making the datasource no longer viable.
return self._check_via_dict(data, RC_NOT_FOUND)
self._check_via_dict(data, RC_NOT_FOUND)


def blkid_out(disks=None):
Expand Down

0 comments on commit 3a5ee6b

Please sign in to comment.