From f19a23c53217a3eb6506744a1290c855d1081f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sun, 25 Oct 2020 18:26:15 +0100 Subject: [PATCH] Test delete_remote_testfolders updated to python3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch changes the test to use always strings and not bytes or bytearrays. Now the test runs fine. Signed-off-by: Rodolfo García Peñas (kix) --- test/OLItest/TestRunner.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/OLItest/TestRunner.py b/test/OLItest/TestRunner.py index b6709c8..28ce5fa 100644 --- a/test/OLItest/TestRunner.py +++ b/test/OLItest/TestRunner.py @@ -147,7 +147,7 @@ class OLITestLib: continue if isinstance(d, tuple): # literal (unquoted) - folder = b'"%s"' % d[1].replace('"', '\\"') + folder = '"%s"' % d[1].replace('"', '\\"') else: m = re.search(br''' [ ] # space @@ -156,13 +156,15 @@ class OLITestLib: ([^"]|\\")* # a non-quote or a backslashded quote (?P=quote))$ # ending quote ''', d, flags=re.VERBOSE) - folder = bytearray(m.group('dir')) + folder = m.group('dir').decode('utf-8') if not m.group('quote'): folder = '"%s"' % folder # folder = folder.replace(br'\"', b'"') # remove quoting dirs.append(folder) # 2) filter out those not starting with INBOX.OLItest and del... - dirs = [d for d in dirs if d.startswith(b'"INBOX.OLItest') or d.startswith(b'"INBOX/OLItest')] + dirs = [d for d in dirs + if d.startswith('"INBOX.OLItest') + or d.startswith('"INBOX/OLItest')] for folder in dirs: res_t, data = imapobj.delete(folder) assert res_t == 'OK', "Folder deletion of {0} failed with error" \