mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
gh-120417: Use import_helper() in test_regrtest (#120680)
This commit is contained in:
parent
d8cd0fa4e3
commit
f869bcfc5b
1 changed files with 12 additions and 14 deletions
|
|
@ -22,7 +22,8 @@ import tempfile
|
||||||
import textwrap
|
import textwrap
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import os_helper, without_optimizer
|
from test.support import import_helper
|
||||||
|
from test.support import os_helper
|
||||||
from test.libregrtest import cmdline
|
from test.libregrtest import cmdline
|
||||||
from test.libregrtest import main
|
from test.libregrtest import main
|
||||||
from test.libregrtest import setup
|
from test.libregrtest import setup
|
||||||
|
|
@ -1178,7 +1179,7 @@ class ArgsTestCase(BaseTestCase):
|
||||||
stats=TestStats(4, 1),
|
stats=TestStats(4, 1),
|
||||||
forever=True)
|
forever=True)
|
||||||
|
|
||||||
@without_optimizer
|
@support.without_optimizer
|
||||||
def check_leak(self, code, what, *, run_workers=False):
|
def check_leak(self, code, what, *, run_workers=False):
|
||||||
test = self.create_test('huntrleaks', code=code)
|
test = self.create_test('huntrleaks', code=code)
|
||||||
|
|
||||||
|
|
@ -1746,10 +1747,9 @@ class ArgsTestCase(BaseTestCase):
|
||||||
|
|
||||||
@support.cpython_only
|
@support.cpython_only
|
||||||
def test_uncollectable(self):
|
def test_uncollectable(self):
|
||||||
try:
|
# Skip test if _testcapi is missing
|
||||||
import _testcapi
|
import_helper.import_module('_testcapi')
|
||||||
except ImportError:
|
|
||||||
raise unittest.SkipTest("requires _testcapi")
|
|
||||||
code = textwrap.dedent(r"""
|
code = textwrap.dedent(r"""
|
||||||
import _testcapi
|
import _testcapi
|
||||||
import gc
|
import gc
|
||||||
|
|
@ -2132,10 +2132,10 @@ class ArgsTestCase(BaseTestCase):
|
||||||
|
|
||||||
def check_add_python_opts(self, option):
|
def check_add_python_opts(self, option):
|
||||||
# --fast-ci and --slow-ci add "-u -W default -bb -E" options to Python
|
# --fast-ci and --slow-ci add "-u -W default -bb -E" options to Python
|
||||||
try:
|
|
||||||
import _testinternalcapi
|
# Skip test if _testinternalcapi is missing
|
||||||
except ImportError:
|
import_helper.import_module('_testinternalcapi')
|
||||||
raise unittest.SkipTest("requires _testinternalcapi")
|
|
||||||
code = textwrap.dedent(r"""
|
code = textwrap.dedent(r"""
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
@ -2198,10 +2198,8 @@ class ArgsTestCase(BaseTestCase):
|
||||||
@unittest.skipIf(support.is_android,
|
@unittest.skipIf(support.is_android,
|
||||||
'raising SIGSEGV on Android is unreliable')
|
'raising SIGSEGV on Android is unreliable')
|
||||||
def test_worker_output_on_failure(self):
|
def test_worker_output_on_failure(self):
|
||||||
try:
|
# Skip test if faulthandler is missing
|
||||||
from faulthandler import _sigsegv
|
import_helper.import_module('faulthandler')
|
||||||
except ImportError:
|
|
||||||
self.skipTest("need faulthandler._sigsegv")
|
|
||||||
|
|
||||||
code = textwrap.dedent(r"""
|
code = textwrap.dedent(r"""
|
||||||
import faulthandler
|
import faulthandler
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue