mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40275: Use new test.support helper submodules in tests (GH-21743)
This commit is contained in:
parent
52f98424a5
commit
79bb2c93f2
20 changed files with 73 additions and 56 deletions
|
@ -15,6 +15,7 @@ import socketserver
|
|||
|
||||
import test.support
|
||||
from test.support import reap_children, verbose
|
||||
from test.support import os_helper
|
||||
from test.support import socket_helper
|
||||
from test.support import threading_helper
|
||||
|
||||
|
@ -299,7 +300,7 @@ class ErrorHandlerTest(unittest.TestCase):
|
|||
KeyboardInterrupt are not passed."""
|
||||
|
||||
def tearDown(self):
|
||||
test.support.unlink(test.support.TESTFN)
|
||||
os_helper.unlink(os_helper.TESTFN)
|
||||
|
||||
def test_sync_handled(self):
|
||||
BaseErrorTestServer(ValueError)
|
||||
|
@ -329,7 +330,7 @@ class ErrorHandlerTest(unittest.TestCase):
|
|||
self.check_result(handled=False)
|
||||
|
||||
def check_result(self, handled):
|
||||
with open(test.support.TESTFN) as log:
|
||||
with open(os_helper.TESTFN) as log:
|
||||
expected = 'Handler called\n' + 'Error handled\n' * handled
|
||||
self.assertEqual(log.read(), expected)
|
||||
|
||||
|
@ -347,7 +348,7 @@ class BaseErrorTestServer(socketserver.TCPServer):
|
|||
self.wait_done()
|
||||
|
||||
def handle_error(self, request, client_address):
|
||||
with open(test.support.TESTFN, 'a') as log:
|
||||
with open(os_helper.TESTFN, 'a') as log:
|
||||
log.write('Error handled\n')
|
||||
|
||||
def wait_done(self):
|
||||
|
@ -356,7 +357,7 @@ class BaseErrorTestServer(socketserver.TCPServer):
|
|||
|
||||
class BadHandler(socketserver.BaseRequestHandler):
|
||||
def handle(self):
|
||||
with open(test.support.TESTFN, 'a') as log:
|
||||
with open(os_helper.TESTFN, 'a') as log:
|
||||
log.write('Handler called\n')
|
||||
raise self.server.exception('Test error')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue