Skip to content

Commit aa83a6a

Browse files
committed
Fix the test on Windows
1 parent acf7188 commit aa83a6a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/test/test_embed.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,12 +603,13 @@ def test_init_run_main_code_exitcode(self):
603603
code)
604604

605605
def test_init_run_main_script_exitcode(self):
606-
with tempfile.NamedTemporaryFile(mode='w', suffix='.py') as tmp:
607-
tmp.write(CODE_EXITCODE_123)
608-
tmp.flush()
606+
with tempfile.TemporaryDirectory() as tmpdir:
607+
filename = os.path.join(tmpdir, 'script.py')
608+
with open(filename, 'w') as fp:
609+
fp.write(CODE_EXITCODE_123)
609610

610611
self.run_embedded_interpreter("test_init_run_main_script_exitcode",
611-
tmp.name)
612+
filename)
612613

613614
def test_init_run_main_interactive_exitcode(self):
614615
code = CODE_EXITCODE_123

0 commit comments

Comments
 (0)