From 0cb7d3f9b4e6fb6da4c689c2ab3167830544cd51 Mon Sep 17 00:00:00 2001 From: Mihai Tudor Panu Date: Mon, 12 Jun 2017 20:38:10 -0700 Subject: [PATCH] tests: harden tests for handling universal line endings Signed-off-by: Mihai Tudor Panu --- tests/check_autoloadlibrary.py | 2 +- tests/check_consistency.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/check_autoloadlibrary.py b/tests/check_autoloadlibrary.py index fcbde099..e91e260c 100755 --- a/tests/check_autoloadlibrary.py +++ b/tests/check_autoloadlibrary.py @@ -29,7 +29,7 @@ class AutoLoadLibrary(u.TestCase): moduleName = fileName[:-2] snippet = prefix + moduleName + suffix - with open(os.path.join(subdir, fileName), "r") as f: + with open(os.path.join(subdir, fileName), "rU") as f: #read in entire file data = f.read() #Make sure it is module diff --git a/tests/check_consistency.py b/tests/check_consistency.py index c1308f8a..3a129080 100755 --- a/tests/check_consistency.py +++ b/tests/check_consistency.py @@ -14,7 +14,7 @@ class BlacklistConsistency(u.TestCase): def test_java_blacklist(self): with open(javaBlacklistFile) as f: - blacklist = [line.rstrip('\n') for line in f] + blacklist = [line.rstrip('\r\n') for line in f] for libraryName in blacklist: files = os.listdir( os.path.join(rootDir, libraryName)) @@ -29,7 +29,7 @@ class BlacklistConsistency(u.TestCase): def test_python_blacklist(self): with open(pythonBlacklistFile) as f: - blacklist = [line.rstrip('\n') for line in f] + blacklist = [line.rstrip('\r\n') for line in f] for libraryName in blacklist: files = os.listdir( os.path.join(rootDir, libraryName)) @@ -44,7 +44,7 @@ class BlacklistConsistency(u.TestCase): def test_node_blacklist(self): with open(nodeBlacklistFile) as f: - blacklist = [line.rstrip('\n') for line in f] + blacklist = [line.rstrip('\r\n') for line in f] for libraryName in blacklist: files = os.listdir( os.path.join(rootDir, libraryName))