Skip to content

Commit

Permalink
Merge pull request #1165 from tbzatek/python-escaping
Browse files Browse the repository at this point in the history
integration-test: Fix invalid escaping
  • Loading branch information
tbzatek committed Aug 8, 2023
2 parents b4924ca + 11dfecf commit 8fa2d2b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/tests/dbus-tests/test_30_iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/dbus-tests/test_80_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/tests/integration-test
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class UDisksTestCase(unittest.TestCase):

# read make variables
make_vars = {}
var_re = re.compile('^([a-zA-Z_]+) = (.*)$')
var_re = re.compile(r'^([a-zA-Z_]+) = (.*)$')
make = subprocess.Popen(['make', '-p', '/dev/null'],
stdout=subprocess.PIPE)
for l in make.stdout:
Expand All @@ -398,7 +398,7 @@ class UDisksTestCase(unittest.TestCase):
make.wait()

# expand make variables
subst_re = re.compile('\${([a-zA-Z_]+)}')
subst_re = re.compile(r'${([a-zA-Z_]+)}')
for (k, v) in make_vars.items():
while True:
m = subst_re.search(v)
Expand Down Expand Up @@ -1044,13 +1044,13 @@ class FS(UDisksTestCase):

# change label
supported = True
l = 'n"a\m\\"e' + fs_type
l = r'n"a$m\"e' + fs_type
if fs_type == 'vfat':
# VFAT does not support some characters
self.assertRaises(GLib.GError, fs.call_set_label_sync, l, no_options, None)
l = "n@a$me"
l = r'n@a$me'
elif fs_type == 'exfat':
l = 'n"a\m\\"exft'
l = r'n"a$m\"exft'
try:
fs.call_set_label_sync(l, no_options, None)
except GLib.GError as e:
Expand Down

0 comments on commit 8fa2d2b

Please sign in to comment.