@@ -57,10 +57,10 @@ def extract_docstrings_from_str(self, module_content):
5757 """ utility: return all msgids extracted from module_content """
5858 filename = 'test_docstrings.py'
5959 with temp_cwd (None ) as cwd :
60- with open (filename , 'w' ) as fp :
60+ with open (filename , 'w' , encoding = 'utf-8' ) as fp :
6161 fp .write (module_content )
6262 assert_python_ok (self .script , '-D' , filename )
63- with open ('messages.pot' ) as fp :
63+ with open ('messages.pot' , encoding = 'utf-8' ) as fp :
6464 data = fp .read ()
6565 return self .get_msgids (data )
6666
@@ -70,7 +70,7 @@ def test_header(self):
7070 """
7171 with temp_cwd (None ) as cwd :
7272 assert_python_ok (self .script )
73- with open ('messages.pot' ) as fp :
73+ with open ('messages.pot' , encoding = 'utf-8' ) as fp :
7474 data = fp .read ()
7575 header = self .get_header (data )
7676
@@ -97,7 +97,7 @@ def test_POT_Creation_Date(self):
9797 from datetime import datetime
9898 with temp_cwd (None ) as cwd :
9999 assert_python_ok (self .script )
100- with open ('messages.pot' ) as fp :
100+ with open ('messages.pot' , encoding = 'utf-8' ) as fp :
101101 data = fp .read ()
102102 header = self .get_header (data )
103103 creationDate = header ['POT-Creation-Date' ]
@@ -299,16 +299,19 @@ def test_files_list(self):
299299 text3 = 'Text to ignore'
300300 with temp_cwd (None ), temp_dir (None ) as sdir :
301301 os .mkdir (os .path .join (sdir , 'pypkg' ))
302- with open (os .path .join (sdir , 'pypkg' , 'pymod.py' ), 'w' ) as sfile :
302+ with open (os .path .join (sdir , 'pypkg' , 'pymod.py' ), 'w' ,
303+ encoding = 'utf-8' ) as sfile :
303304 sfile .write (f'_({ text1 !r} )' )
304305 os .mkdir (os .path .join (sdir , 'pkg.py' ))
305- with open (os .path .join (sdir , 'pkg.py' , 'pymod2.py' ), 'w' ) as sfile :
306+ with open (os .path .join (sdir , 'pkg.py' , 'pymod2.py' ), 'w' ,
307+ encoding = 'utf-8' ) as sfile :
306308 sfile .write (f'_({ text2 !r} )' )
307309 os .mkdir (os .path .join (sdir , 'CVS' ))
308- with open (os .path .join (sdir , 'CVS' , 'pymod3.py' ), 'w' ) as sfile :
310+ with open (os .path .join (sdir , 'CVS' , 'pymod3.py' ), 'w' ,
311+ encoding = 'utf-8' ) as sfile :
309312 sfile .write (f'_({ text3 !r} )' )
310313 assert_python_ok (self .script , sdir )
311- with open ('messages.pot' ) as fp :
314+ with open ('messages.pot' , encoding = 'utf-8' ) as fp :
312315 data = fp .read ()
313316 self .assertIn (f'msgid "{ text1 } "' , data )
314317 self .assertIn (f'msgid "{ text2 } "' , data )
0 commit comments