Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Lib/test/test_filecmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ def setUp(self):
self.name_diff = os_helper.TESTFN + '-diff'
data = 'Contents of file go here.\n'
for name in [self.name, self.name_same, self.name_diff]:
with open(name, 'w') as output:
with open(name, 'w', encoding="utf-8") as output:
output.write(data)

with open(self.name_diff, 'a+') as output:
with open(self.name_diff, 'a+', encoding="utf-8") as output:
output.write('An extra line.\n')
self.dir = tempfile.gettempdir()

Expand Down Expand Up @@ -72,10 +72,10 @@ def setUp(self):
fn = 'FiLe' # Verify case-insensitive comparison
else:
fn = 'file'
with open(os.path.join(dir, fn), 'w') as output:
with open(os.path.join(dir, fn), 'w', encoding="utf-8") as output:
output.write(data)

with open(os.path.join(self.dir_diff, 'file2'), 'w') as output:
with open(os.path.join(self.dir_diff, 'file2'), 'w', encoding="utf-8") as output:
output.write('An extra file.\n')

def tearDown(self):
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_cmpfiles(self):
"Comparing directory to same fails")

# Add different file2
with open(os.path.join(self.dir, 'file2'), 'w') as output:
with open(os.path.join(self.dir, 'file2'), 'w', encoding="utf-8") as output:
output.write('Different contents.\n')

self.assertFalse(filecmp.cmpfiles(self.dir, self.dir_same,
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_dircmp(self):
self._assert_report(d.report, expected_report)

# Add different file2
with open(os.path.join(self.dir_diff, 'file2'), 'w') as output:
with open(os.path.join(self.dir_diff, 'file2'), 'w', encoding="utf-8") as output:
output.write('Different contents.\n')
d = filecmp.dircmp(self.dir, self.dir_diff)
self.assertEqual(d.same_files, ['file'])
Expand Down