Improve the test file compare function
This commit is contained in:
+4
-8
@@ -70,20 +70,19 @@ def cmpFiles(
|
||||
ignoreLines = []
|
||||
|
||||
try:
|
||||
foOne = open(fileOne, mode="r", encoding="utf-8")
|
||||
with open(fileOne, mode="r", encoding="utf-8") as fo:
|
||||
txtOne = fo.read().strip().splitlines()
|
||||
except Exception as exc:
|
||||
print(str(exc))
|
||||
return False
|
||||
|
||||
try:
|
||||
foTwo = open(fileTwo, mode="r", encoding="utf-8")
|
||||
with open(fileTwo, mode="r", encoding="utf-8") as fo:
|
||||
txtTwo = fo.read().strip().splitlines()
|
||||
except Exception as exc:
|
||||
print(str(exc))
|
||||
return False
|
||||
|
||||
txtOne = foOne.readlines()
|
||||
txtTwo = foTwo.readlines()
|
||||
|
||||
if len(txtOne) != len(txtTwo):
|
||||
print("Files are not the same length")
|
||||
return False
|
||||
@@ -108,9 +107,6 @@ def cmpFiles(
|
||||
print(" >> '%s'" % lnTwo)
|
||||
diffFound = True
|
||||
|
||||
foOne.close()
|
||||
foTwo.close()
|
||||
|
||||
return not diffFound
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user