From 044e0833004273296866921089e909dbe22e3ddb Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 4 Dec 2023 13:26:12 -0500 Subject: [PATCH] Sort out some tests Signed-off-by: mulhern --- tests/whitebox/integration/test_stratis.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/whitebox/integration/test_stratis.py b/tests/whitebox/integration/test_stratis.py index 0d128374d..1c5112f90 100644 --- a/tests/whitebox/integration/test_stratis.py +++ b/tests/whitebox/integration/test_stratis.py @@ -23,6 +23,7 @@ # isort: LOCAL from stratis_cli import StratisCliErrorCodes, run +from stratis_cli._actions import _dynamic from stratis_cli._errors import StratisCliStratisdVersionError from ._misc import RUNNER, TEST_RUNNER, RunTestCase, SimTestCase @@ -76,15 +77,14 @@ def test_outdated_stratisd_version(self): Verify that an outdated version of stratisd will produce a StratisCliStratisdVersionError. """ - # pylint: disable=import-outside-toplevel - # isort: LOCAL - from stratis_cli._actions import _data + _dynamic.make_dyn_class("Manager0") command_line = ["--propagate", "daemon", "version"] - # pylint: disable=protected-access with patch.object( - _data.Manager0.Properties.Version, + _dynamic._LOOKUP["Manager0"][ # pylint: disable=protected-access + 2 + ].Properties.Version, "Get", return_value="1.0.0", ): @@ -107,12 +107,14 @@ def test_catch_keyboard_exception(self): at the calling method generated by dbus-python-client-gen. """ - # pylint: disable=import-outside-toplevel - # isort: LOCAL - from stratis_cli._actions import _data + _dynamic.make_dyn_class("Manager0") with patch.object( - _data.Manager0.Properties.Version, "Get", side_effect=KeyboardInterrupt() + _dynamic._LOOKUP["Manager0"][ # pylint: disable=protected-access + 2 + ].Properties.Version, + "Get", + side_effect=KeyboardInterrupt(), ): with self.assertRaises(KeyboardInterrupt): run()(["daemon", "version"])