From: John Mulligan Date: Fri, 1 Nov 2024 18:38:11 +0000 (-0400) Subject: cephadm: mock a call to shutil.rmtree X-Git-Tag: v20.0.0~647^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a529b234a24dceaee146907c6c3d57cc6944127b;p=ceph.git cephadm: mock a call to shutil.rmtree Mock out calls to shutil.rmtree in test_deploy_and_rm_iscsi. The test never asserts that things in the file system are removed, so making the call a no-op is safe. Calling shutil.rmtree with the fake file system enabled recently became a problem. In python 3.12 (or 3.11?) changes to the shutil module function shutil.rmtree are incompatible with the fake file system that cephadm tests rely upon heavily. Part of an effort to get ceph tox environments passing on Python 3.12. Signed-off-by: John Mulligan --- diff --git a/src/cephadm/tests/test_deploy.py b/src/cephadm/tests/test_deploy.py index 58f212beff6..c5094db335f 100644 --- a/src/cephadm/tests/test_deploy.py +++ b/src/cephadm/tests/test_deploy.py @@ -495,6 +495,7 @@ def test_deploy_ceph_exporter_container(cephadm_fs, funkypatch): def test_deploy_and_rm_iscsi(cephadm_fs, funkypatch): # Test that the deploy and remove paths for iscsi (which has sidecar container) # create and remove the correct unit files. + funkypatch.patch('shutil.rmtree') # fakefs + shutil.rmtree breaks on py3.12 mocks = _common_patches(funkypatch) _firewalld = mocks['Firewalld'] fsid = 'b01dbeef-701d-9abe-0000-e1e5a47004a7'