Explicitly decode test files as UTF-8
This way the test does not fail if run in a non-UTF-8 locale. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
ed9d7f69a6
commit
2efc4d8561
@ -27,10 +27,10 @@ class CompsWrapperTest(unittest.TestCase):
|
|||||||
self.file = tempfile.NamedTemporaryFile(prefix='comps-wrapper-test-')
|
self.file = tempfile.NamedTemporaryFile(prefix='comps-wrapper-test-')
|
||||||
|
|
||||||
def assertFilesEqual(self, fn1, fn2):
|
def assertFilesEqual(self, fn1, fn2):
|
||||||
with open(fn1) as f1:
|
with open(fn1, 'rb') as f1:
|
||||||
lines1 = f1.read().splitlines()
|
lines1 = f1.read().decode('utf-8').splitlines()
|
||||||
with open(fn2) as f2:
|
with open(fn2, 'rb') as f2:
|
||||||
lines2 = f2.read().splitlines()
|
lines2 = f2.read().decode('utf-8').splitlines()
|
||||||
diff = '\n'.join(difflib.unified_diff(lines1, lines2,
|
diff = '\n'.join(difflib.unified_diff(lines1, lines2,
|
||||||
fromfile='EXPECTED', tofile='ACTUAL'))
|
fromfile='EXPECTED', tofile='ACTUAL'))
|
||||||
self.assertEqual(diff, '', 'Files differ:\n' + diff)
|
self.assertEqual(diff, '', 'Files differ:\n' + diff)
|
||||||
|
Loading…
Reference in New Issue
Block a user