From 11dfecfd1f0805ab851825310a98176413647dcc Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Mon, 7 Aug 2023 17:10:48 +0200 Subject: [PATCH] tests: Fix regex escaping --- src/tests/dbus-tests/test_30_iscsi.py | 2 +- src/tests/dbus-tests/test_80_filesystem.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/dbus-tests/test_30_iscsi.py b/src/tests/dbus-tests/test_30_iscsi.py index 6ecf22a4f..7e71c4bf8 100644 --- a/src/tests/dbus-tests/test_30_iscsi.py +++ b/src/tests/dbus-tests/test_30_iscsi.py @@ -164,7 +164,7 @@ def test_login_chap_auth(self): options['node.session.auth.chap_algs'] = 'SHA3-256,SHA256,SHA1' # disallow MD5 options['username'] = self.initiator - msg = 'Login failed: initiator reported error \(24 - iSCSI login failed due to authorization failure\)' + msg = r'Login failed: initiator reported error \(24 - iSCSI login failed due to authorization failure\)' # missing auth info with six.assertRaisesRegex(self, dbus.exceptions.DBusException, msg): manager.Login(iqn, tpg, host, port, iface, self.no_options, diff --git a/src/tests/dbus-tests/test_80_filesystem.py b/src/tests/dbus-tests/test_80_filesystem.py index 71c011ae0..59946720c 100644 --- a/src/tests/dbus-tests/test_80_filesystem.py +++ b/src/tests/dbus-tests/test_80_filesystem.py @@ -482,7 +482,7 @@ def test_custom_option(self, should_fail, dbus_option, should_be_present, config else: mnt_path = block_fs.Mount(dd, dbus_interface=self.iface_prefix + '.Filesystem') self.assertTrue(os.path.ismount(mnt_path)) - _ret, out = self.run_command('mount | grep %s | sed "s/.*(\(.*\))/\\1/"' % block_fs_dev) + _ret, out = self.run_command(r'mount | grep %s | sed "s/.*(\(.*\))/\\1/"' % block_fs_dev) if dbus_option is not None: if should_be_present: self.assertIn(dbus_option, out)