]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: update argparse help output assertions for python compatibility 67047/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Thu, 22 Jan 2026 14:38:13 +0000 (14:38 +0000)
committerGuillaume Abrioux <gabrioux@ibm.com>
Thu, 22 Jan 2026 15:09:54 +0000 (16:09 +0100)
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 <gabrioux@ibm.com>
src/ceph-volume/ceph_volume/tests/devices/lvm/test_prepare.py
src/ceph-volume/ceph_volume/tests/devices/test_zap.py
src/ceph-volume/ceph_volume/tests/util/test_device.py

index 89843d3f66b60f954f77d053374b27ebcafc8d61..e85250d3dbc2160cee10cfd916c7cbda1624f47c 100644 (file)
@@ -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
index 5f72ea0221b9ef38f544fc046c9ce8d4a3403585..d54ac73144438ef593258caa9fe4a9df700634c5 100644 (file)
@@ -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',
index e238cdfb6677d0299c5cda8b4d94864581d6fc91..ea7d97e1634d620615445aa3a23888f1fb10d9f1 100644 (file)
@@ -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")