Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa61261

Browse files
committed
Use the import_helper for even fewer LOC
1 parent caff72b commit fa61261

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Lib/test/test_builtin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import fractions
1010
import gc
1111
import io
12-
import importlib
1312
import locale
1413
import math
1514
import os
@@ -32,6 +31,7 @@
3231
from operator import neg
3332
from test import support
3433
from test.support import (cpython_only, swap_attr, maybe_get_event_loop_policy)
34+
from test.support.import_helper import import_module
3535
from test.support.os_helper import (EnvironmentVarGuard, TESTFN, unlink)
3636
from test.support.script_helper import assert_python_ok
3737
from test.support.warnings_helper import check_warnings
@@ -2413,11 +2413,7 @@ def detach_readline(self):
24132413
# since test_builtin is not intended to test
24142414
# the readline module, but the builtins module.
24152415
if "readline" in sys.modules:
2416-
try:
2417-
c = importlib.import_module("ctypes")
2418-
except ImportError:
2419-
self.skipTest("the readline module is loaded")
2420-
2416+
c = import_module("ctypes")
24212417
fp_api = "PyOS_ReadlineFunctionPointer"
24222418
prev_value = c.c_void_p.in_dll(c.pythonapi, fp_api).value
24232419
c.c_void_p.in_dll(c.pythonapi, fp_api).value = None

0 commit comments

Comments
 (0)