@@ -15,10 +15,10 @@ def setUp(self):
15
15
self .name_diff = os_helper .TESTFN + '-diff'
16
16
data = 'Contents of file go here.\n '
17
17
for name in [self .name , self .name_same , self .name_diff ]:
18
- with open (name , 'w' ) as output :
18
+ with open (name , 'w' , encoding = "utf-8" ) as output :
19
19
output .write (data )
20
20
21
- with open (self .name_diff , 'a+' ) as output :
21
+ with open (self .name_diff , 'a+' , encoding = "utf-8" ) as output :
22
22
output .write ('An extra line.\n ' )
23
23
self .dir = tempfile .gettempdir ()
24
24
@@ -72,10 +72,10 @@ def setUp(self):
72
72
fn = 'FiLe' # Verify case-insensitive comparison
73
73
else :
74
74
fn = 'file'
75
- with open (os .path .join (dir , fn ), 'w' ) as output :
75
+ with open (os .path .join (dir , fn ), 'w' , encoding = "utf-8" ) as output :
76
76
output .write (data )
77
77
78
- with open (os .path .join (self .dir_diff , 'file2' ), 'w' ) as output :
78
+ with open (os .path .join (self .dir_diff , 'file2' ), 'w' , encoding = "utf-8" ) as output :
79
79
output .write ('An extra file.\n ' )
80
80
81
81
def tearDown (self ):
@@ -103,7 +103,7 @@ def test_cmpfiles(self):
103
103
"Comparing directory to same fails" )
104
104
105
105
# Add different file2
106
- with open (os .path .join (self .dir , 'file2' ), 'w' ) as output :
106
+ with open (os .path .join (self .dir , 'file2' ), 'w' , encoding = "utf-8" ) as output :
107
107
output .write ('Different contents.\n ' )
108
108
109
109
self .assertFalse (filecmp .cmpfiles (self .dir , self .dir_same ,
@@ -188,7 +188,7 @@ def test_dircmp(self):
188
188
self ._assert_report (d .report , expected_report )
189
189
190
190
# Add different file2
191
- with open (os .path .join (self .dir_diff , 'file2' ), 'w' ) as output :
191
+ with open (os .path .join (self .dir_diff , 'file2' ), 'w' , encoding = "utf-8" ) as output :
192
192
output .write ('Different contents.\n ' )
193
193
d = filecmp .dircmp (self .dir , self .dir_diff )
194
194
self .assertEqual (d .same_files , ['file' ])
0 commit comments