Blob Blame History Raw
commit 8f9c5c6f83506500ede295179975f2ff6649327b
Author: Tom Hughes <tom@compton.nu>
Date:   Fri Apr 6 13:59:08 2018 +0100

    Patch to support python 3

diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
index a2ab5d5a..d576165f 100755
--- a/scripts/approvalTests.py
+++ b/scripts/approvalTests.py
@@ -73,9 +73,9 @@ else:
 overallResult = 0
 
 def diffFiles(fileA, fileB):
-    with open(fileA, 'r') as file:
+    with open(fileA, 'r', errors='surrogateescape') as file:
         aLines = [line.rstrip() for line in file.readlines()]
-    with open(fileB, 'r') as file:
+    with open(fileB, 'r', errors='surrogateescape') as file:
         bLines = [line.rstrip() for line in file.readlines()]
 
     shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
@@ -139,8 +139,8 @@ def approve(baseName, args):
     subprocess.call(args, stdout=f, stderr=f)
     f.close()
 
-    rawFile = open(rawResultsPath, 'r')
-    filteredFile = open(filteredResultsPath, 'w')
+    rawFile = open(rawResultsPath, 'r', errors='surrogateescape')
+    filteredFile = open(filteredResultsPath, 'w', errors='surrogateescape')
     for line in rawFile:
         filteredFile.write(filterLine(line).rstrip() + "\n")
     filteredFile.close()