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

Use new test.support helper submodules in tests:

* distutils tests
* test_buffer
* test_compile
* test_filecmp
* test_fileinput
* test_readline
* test_smtpnet
* test_structmembers
* test_tools
This commit is contained in:
Hai Shi 2020-06-26 01:17:57 +08:00 committed by GitHub
parent 700cfa8c90
commit 847f94f47b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 69 additions and 42 deletions

View file

@ -1,8 +1,9 @@
import unittest
from test import support
from test.support import import_helper
from test.support import warnings_helper
# Skip this test if the _testcapi module isn't available.
support.import_module('_testcapi')
import_helper.import_module('_testcapi')
from _testcapi import _test_structmembersType, \
CHAR_MAX, CHAR_MIN, UCHAR_MAX, \
SHRT_MAX, SHRT_MIN, USHRT_MAX, \
@ -116,27 +117,27 @@ class ReadWriteTests(unittest.TestCase):
class TestWarnings(unittest.TestCase):
def test_byte_max(self):
with support.check_warnings(('', RuntimeWarning)):
with warnings_helper.check_warnings(('', RuntimeWarning)):
ts.T_BYTE = CHAR_MAX+1
def test_byte_min(self):
with support.check_warnings(('', RuntimeWarning)):
with warnings_helper.check_warnings(('', RuntimeWarning)):
ts.T_BYTE = CHAR_MIN-1
def test_ubyte_max(self):
with support.check_warnings(('', RuntimeWarning)):
with warnings_helper.check_warnings(('', RuntimeWarning)):
ts.T_UBYTE = UCHAR_MAX+1
def test_short_max(self):
with support.check_warnings(('', RuntimeWarning)):
with warnings_helper.check_warnings(('', RuntimeWarning)):
ts.T_SHORT = SHRT_MAX+1
def test_short_min(self):
with support.check_warnings(('', RuntimeWarning)):
with warnings_helper.check_warnings(('', RuntimeWarning)):
ts.T_SHORT = SHRT_MIN-1
def test_ushort_max(self):
with support.check_warnings(('', RuntimeWarning)):
with warnings_helper.check_warnings(('', RuntimeWarning)):
ts.T_USHORT = USHRT_MAX+1