@@ -33,7 +33,7 @@ def test_custom_config():
33
33
app = DummyApp ()
34
34
td = mkdtemp ()
35
35
fname = pjoin (td , 'config.py' )
36
- with open (fname , 'w' ) as f :
36
+ with open (fname , 'w' , encoding = 'utf-8' ) as f :
37
37
f .write (_dummy_config )
38
38
app .initialize (['--config' , fname ])
39
39
shutil .rmtree (td )
@@ -44,7 +44,7 @@ def test_cli_override():
44
44
app = DummyApp ()
45
45
td = mkdtemp ()
46
46
fname = pjoin (td , 'config.py' )
47
- with open (fname , 'w' ) as f :
47
+ with open (fname , 'w' , encoding = 'utf-8' ) as f :
48
48
f .write (_dummy_config )
49
49
app .initialize (['--config' , fname , '--DummyApp.n=20' ])
50
50
shutil .rmtree (td )
@@ -66,7 +66,7 @@ def test_generate_config():
66
66
def test_load_config ():
67
67
config_dir = mkdtemp ()
68
68
wd = mkdtemp ()
69
- with open (pjoin (config_dir , 'dummy_app_config.py' ), 'w' ) as f :
69
+ with open (pjoin (config_dir , 'dummy_app_config.py' ), 'w' , encoding = 'utf-8' ) as f :
70
70
f .write ('c.DummyApp.m = 1\n ' )
71
71
f .write ('c.DummyApp.n = 1' )
72
72
with patch .object (os , 'getcwd' , lambda : wd ):
@@ -75,7 +75,7 @@ def test_load_config():
75
75
76
76
assert app .n == 1 , "Loaded config from config dir"
77
77
78
- with open (pjoin (wd , 'dummy_app_config.py' ), 'w' ) as f :
78
+ with open (pjoin (wd , 'dummy_app_config.py' ), 'w' , encoding = 'utf-8' ) as f :
79
79
f .write ('c.DummyApp.n = 2' )
80
80
81
81
with patch .object (os , 'getcwd' , lambda : wd ):
@@ -92,7 +92,7 @@ def test_load_config():
92
92
def test_load_bad_config ():
93
93
config_dir = mkdtemp ()
94
94
wd = mkdtemp ()
95
- with open (pjoin (config_dir , 'dummy_app_config.py' ), 'w' ) as f :
95
+ with open (pjoin (config_dir , 'dummy_app_config.py' ), 'w' , encoding = 'utf-8' ) as f :
96
96
f .write ('c.DummyApp.m = "a\n ' ) # Syntax error
97
97
with patch .object (os , 'getcwd' , lambda : wd ):
98
98
with pytest .raises (SyntaxError ):
0 commit comments