Skip to content

Commit 6589e9f

Browse files
committed
Fix formatting
1 parent e0933bb commit 6589e9f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Lib/test/test_traceback.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
from test.support import (Error, captured_output, cpython_only, ALWAYS_EQ,
1919
requires_debug_ranges, has_no_debug_ranges,
2020
requires_subprocess)
21-
from test.support import script_helper
22-
from test.support import os_helper
23-
from test.support.os_helper import TESTFN, unlink
21+
from test.support.os_helper import TESTFN, temp_dir, unlink
2422
from test.support.script_helper import assert_python_ok, assert_python_failure, make_script
2523
from test.support.import_helper import forget
2624
from test.support import force_not_colorized, force_not_colorized_test_class
@@ -528,18 +526,23 @@ def __del__(self):
528526

529527
def test_lost_io_open(self):
530528
# GH-142737: Display the traceback even if io.open is lost
531-
code = textwrap.dedent("""\
529+
crasher = textwrap.dedent("""\
532530
import io
533531
import traceback
534532
traceback._print_exception_bltin = None
535533
del io.open
536534
raise RuntimeError("should not crash")
537535
""")
538-
with os_helper.temp_dir() as temp_dir:
539-
script = script_helper.make_script(
540-
script_dir=temp_dir, script_basename='tb_test_no_io_open', source=code)
536+
537+
with temp_dir() as script_dir:
538+
script = make_script(
539+
script_dir=script_dir,
540+
script_basename='tb_test_no_io_open',
541+
source=crasher)
541542
rc, stdout, stderr = assert_python_failure(script)
543+
542544
self.assertEqual(rc, 1) # Make sure it's not a crash
545+
543546
expected = [b'Traceback (most recent call last):',
544547
f' File "{script}", line 5, in <module>'.encode(),
545548
b'RuntimeError: should not crash']

0 commit comments

Comments
 (0)