bpo-40275: Use new test.support helper submodules in tests (GH-21315)

This commit is contained in:
Hai Shi 2020-07-06 17:15:08 +08:00 committed by GitHub
parent 883bc63833
commit a089d21df1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 69 additions and 49 deletions

View file

@ -16,6 +16,7 @@ import textwrap
import unittest
import test.support
from test.support import import_helper
import test.string_tests
import test.list_tests
from test.support import bigaddrspacetest, MAX_Py_ssize_t
@ -967,7 +968,7 @@ class BaseBytesTest:
self.assertEqual(c, b'hllo')
def test_sq_item(self):
_testcapi = test.support.import_module('_testcapi')
_testcapi = import_helper.import_module('_testcapi')
obj = self.type2test((42,))
with self.assertRaises(IndexError):
_testcapi.sequence_getitem(obj, -2)
@ -1024,8 +1025,8 @@ class BytesTest(BaseBytesTest, unittest.TestCase):
# Test PyBytes_FromFormat()
def test_from_format(self):
ctypes = test.support.import_module('ctypes')
_testcapi = test.support.import_module('_testcapi')
ctypes = import_helper.import_module('ctypes')
_testcapi = import_helper.import_module('_testcapi')
from ctypes import pythonapi, py_object
from ctypes import (
c_int, c_uint,