We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 294e404 commit 1958a7aCopy full SHA for 1958a7a
Lib/test/test_atexit.py
@@ -209,19 +209,17 @@ def callback():
209
_testcapi.set_nomemory(0)
210
""")
211
212
- with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
+ with tempfile.NamedTemporaryFile(mode='w', suffix='.py') as f:
213
f.write(code)
214
+ f.flush()
215
script = f.name
216
- try:
217
with SuppressCrashReport():
218
with script_helper.spawn_python(script,
219
stderr=subprocess.PIPE) as proc:
220
proc.wait()
221
stdout = proc.stdout.read()
222
stderr = proc.stderr.read()
223
- finally:
224
- os.unlink(script)
225
226
self.assertIn(proc.returncode, (0, 1))
227
self.assertNotIn(b"hello", stdout)
0 commit comments