@@ -45,7 +45,7 @@ def tearDown(self):
45
45
46
46
def create_readonly_file (self , filename ):
47
47
file_path = os .path .join (self .temp_dir , filename )
48
- with open (file_path , 'w' ) as file :
48
+ with open (file_path , 'w' , encoding = "utf-8" ) as file :
49
49
file .write (filename )
50
50
os .chmod (file_path , stat .S_IREAD )
51
51
@@ -1468,7 +1468,7 @@ def setUp(self):
1468
1468
('invalid' , '@no-such-path\n ' ),
1469
1469
]
1470
1470
for path , text in file_texts :
1471
- with open (path , 'w' ) as file :
1471
+ with open (path , 'w' , encoding = "utf-8" ) as file :
1472
1472
file .write (text )
1473
1473
1474
1474
parser_signature = Sig (fromfile_prefix_chars = '@' )
@@ -1498,7 +1498,7 @@ def setUp(self):
1498
1498
('hello' , 'hello world!\n ' ),
1499
1499
]
1500
1500
for path , text in file_texts :
1501
- with open (path , 'w' ) as file :
1501
+ with open (path , 'w' , encoding = "utf-8" ) as file :
1502
1502
file .write (text )
1503
1503
1504
1504
class FromFileConverterArgumentParser (ErrorRaisingArgumentParser ):
@@ -1580,7 +1580,8 @@ class TestFileTypeR(TempDirMixin, ParserTestCase):
1580
1580
def setUp (self ):
1581
1581
super (TestFileTypeR , self ).setUp ()
1582
1582
for file_name in ['foo' , 'bar' ]:
1583
- with open (os .path .join (self .temp_dir , file_name ), 'w' ) as file :
1583
+ with open (os .path .join (self .temp_dir , file_name ),
1584
+ 'w' , encoding = "utf-8" ) as file :
1584
1585
file .write (file_name )
1585
1586
self .create_readonly_file ('readonly' )
1586
1587
@@ -1601,7 +1602,7 @@ class TestFileTypeDefaults(TempDirMixin, ParserTestCase):
1601
1602
"""Test that a file is not created unless the default is needed"""
1602
1603
def setUp (self ):
1603
1604
super (TestFileTypeDefaults , self ).setUp ()
1604
- file = open (os .path .join (self .temp_dir , 'good' ), 'w' )
1605
+ file = open (os .path .join (self .temp_dir , 'good' ), 'w' , encoding = "utf-8" )
1605
1606
file .write ('good' )
1606
1607
file .close ()
1607
1608
@@ -1620,7 +1621,8 @@ class TestFileTypeRB(TempDirMixin, ParserTestCase):
1620
1621
def setUp (self ):
1621
1622
super (TestFileTypeRB , self ).setUp ()
1622
1623
for file_name in ['foo' , 'bar' ]:
1623
- with open (os .path .join (self .temp_dir , file_name ), 'w' ) as file :
1624
+ with open (os .path .join (self .temp_dir , file_name ),
1625
+ 'w' , encoding = "utf-8" ) as file :
1624
1626
file .write (file_name )
1625
1627
1626
1628
argument_signatures = [
0 commit comments