From: Guillaume Abrioux Date: Thu, 22 Jan 2026 14:38:13 +0000 (+0000) Subject: ceph-volume: update argparse help output assertions for python compatibility X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aa2898c94a13eb2850ba918a76d4d3607951ba03;p=ceph.git ceph-volume: update argparse help output assertions for python compatibility This commit updates test assertions to be more flexible about argparse help output format. It replaces checks for 'optional arguments' and 'positional arguments' with checks for 'positional' and help flags ('-h' or '--help'), which works across different python versions where argparse output format may differ. Signed-off-by: Guillaume Abrioux --- diff --git a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py index 89843d3f66b..e85250d3dbc 100644 --- a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py +++ b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py @@ -56,5 +56,5 @@ class TestActivate(object): with pytest.raises(SystemExit): lvm.activate.Activate(argv=['--help']).main() stdout, stderr = capsys.readouterr() - assert 'optional arguments' in stdout - assert 'positional arguments' in stdout + assert 'positional' in stdout + assert '-h' in stdout or '--help' in stdout diff --git a/src/ceph-volume/ceph_volume/tests/devices/test_zap.py b/src/ceph-volume/ceph_volume/tests/devices/test_zap.py index 5f72ea0221b..d54ac731444 100644 --- a/src/ceph-volume/ceph_volume/tests/devices/test_zap.py +++ b/src/ceph-volume/ceph_volume/tests/devices/test_zap.py @@ -14,7 +14,8 @@ class TestZap(object): with pytest.raises(SystemExit): lvm.zap.Zap(argv=['--help']).main() stdout, stderr = capsys.readouterr() - assert 'optional arguments' in stdout + assert 'positional' in stdout + assert '-h' in stdout or '--help' in stdout @pytest.mark.parametrize('device_name', [ '/dev/mapper/foo', diff --git a/src/ceph-volume/ceph_volume/tests/util/test_device.py b/src/ceph-volume/ceph_volume/tests/util/test_device.py index e238cdfb667..ea7d97e1634 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_device.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_device.py @@ -306,7 +306,7 @@ class TestDevice(object): @patch("ceph_volume.util.disk.has_bluestore_label", lambda x: False) def test_reject_readonly_device(self, fake_call, device_info): - data = {"/dev/cdrom": {"ro": "1"}} + data = {"/dev/cdrom": {"ro": "1", "partitions": {}}} lsblk = {"TYPE": "disk", "NAME": "cdrom"} device_info(devices=data,lsblk=lsblk) disk = device.Device("/dev/cdrom")