From bc50c8b1dd3221d2b93a739055d6e6beb025b66e Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 19 Nov 2022 10:33:48 +0000 Subject: [PATCH] Fix the testsuite for Python no longer supporting 'rU' in open() Gbp-Pq: Name testsuite-python-open-rU.patch --- app/clingo/tests/run.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/clingo/tests/run.py b/app/clingo/tests/run.py index 687089d..757a0e7 100755 --- a/app/clingo/tests/run.py +++ b/app/clingo/tests/run.py @@ -115,7 +115,7 @@ if parse_ret.action == "normalize": args = [clingo, "0", parse_ret.file, "-Wnone"] b = os.path.splitext(parse_ret.file)[0] if os.path.exists(b + ".cmd"): - with open(b + ".cmd", 'rU') as cmd_file: + with open(b + ".cmd", 'r') as cmd_file: for x in cmd_file: args.extend(x.strip().split()) args.extend(extra_argv) @@ -134,7 +134,7 @@ if parse_ret.action == "run": for f in sorted(files): if f.endswith(".lp"): b = os.path.join(root, f[:-3]) - with open(b + ".lp", 'rU', encoding='utf-8') as inst_file: + with open(b + ".lp", 'r', encoding='utf-8') as inst_file: inst = inst_file.read() if (not with_python and re.search(r"#script[ ]*\(python\)", inst)) or \ (not with_lua and re.search(r"#script[ ]*\(lua\)", inst)) or \ @@ -147,13 +147,13 @@ if parse_ret.action == "run": args = [clingo, "0", b + ".lp", "-Wnone"] if os.path.exists(b + ".cmd"): - with open(b + ".cmd", 'rU') as cmd_file: + with open(b + ".cmd", 'r') as cmd_file: for x in cmd_file: args.extend(x.strip().split()) args.extend(extra_argv) out, err = sp.Popen(args, stderr=sp.PIPE, stdout=sp.PIPE, universal_newlines=True).communicate() norm = normalize(out) - with open(b + ".sol", 'rU') as sol_file: + with open(b + ".sol", 'r') as sol_file: sol = reorder(sol_file.read()) if norm != sol: failed+= 1 -- 2.30.2