Skip to content

Commit 00b5a8c

Browse files
committed
fix: use test helper function
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
1 parent 7ab0231 commit 00b5a8c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Lib/test/test_atexit.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import atexit
22
import os
33
import subprocess
4-
import tempfile
54
import textwrap
65
import unittest
76
from test import support
87
from test.support import SuppressCrashReport, script_helper
8+
from test.support import os_helper
99
from test.support import threading_helper
1010

1111
class GeneralTest(unittest.TestCase):
@@ -209,11 +209,8 @@ def callback():
209209
_testcapi.set_nomemory(0)
210210
""")
211211

212-
with tempfile.NamedTemporaryFile(mode='w', suffix='.py') as f:
213-
f.write(code)
214-
f.flush()
215-
script = f.name
216-
212+
with os_helper.temp_dir() as temp_dir:
213+
script = script_helper.make_script(temp_dir, 'test_atexit_script', code)
217214
with SuppressCrashReport():
218215
with script_helper.spawn_python(script,
219216
stderr=subprocess.PIPE) as proc:

0 commit comments

Comments
 (0)