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

This commit is contained in:
Hai Shi 2020-08-04 00:49:18 +08:00 committed by GitHub
parent bb0424b122
commit 4660597b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 185 additions and 154 deletions

View file

@ -13,6 +13,7 @@ import argparse
from io import StringIO
from test import support
from test.support import os_helper
from unittest import mock
class StdIOBuffer(StringIO):
pass
@ -23,7 +24,7 @@ class TestCase(unittest.TestCase):
# The tests assume that line wrapping occurs at 80 columns, but this
# behaviour can be overridden by setting the COLUMNS environment
# variable. To ensure that this width is used, set COLUMNS to 80.
env = support.EnvironmentVarGuard()
env = os_helper.EnvironmentVarGuard()
env['COLUMNS'] = '80'
self.addCleanup(env.__exit__)
@ -3244,7 +3245,7 @@ class TestShortColumns(HelpTestCase):
but we don't want any exceptions thrown in such cases. Only ugly representation.
'''
def setUp(self):
env = support.EnvironmentVarGuard()
env = os_helper.EnvironmentVarGuard()
env.set("COLUMNS", '15')
self.addCleanup(env.__exit__)