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

This commit is contained in:
Hai Shi 2020-08-08 05:55:35 +08:00 committed by GitHub
parent e27a51c11e
commit fcce8c649a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 18 deletions

View file

@ -4,6 +4,8 @@ import sys
import warnings
from inspect import isabstract
from test import support
from test.support import os_helper
try:
from _abc import _get_dump
except ImportError:
@ -61,7 +63,7 @@ def dash_R(ns, test_name, test_func):
return int_pool.setdefault(value, value)
nwarmup, ntracked, fname = ns.huntrleaks
fname = os.path.join(support.SAVEDCWD, fname)
fname = os.path.join(os_helper.SAVEDCWD, fname)
repcount = nwarmup + ntracked
# Pre-allocate to ensure that the loop doesn't allocate anything new
@ -71,7 +73,7 @@ def dash_R(ns, test_name, test_func):
fd_deltas = [0] * repcount
getallocatedblocks = sys.getallocatedblocks
gettotalrefcount = sys.gettotalrefcount
fd_count = support.fd_count
fd_count = os_helper.fd_count
# initialize variables to make pyflakes quiet
rc_before = alloc_before = fd_before = 0

View file

@ -5,7 +5,7 @@ import os
import subprocess
import uuid
import winreg
from test import support
from test.support import os_helper
from test.libregrtest.utils import print_warning
@ -69,7 +69,9 @@ class WindowsLoadTracker():
# Spawn off the load monitor
counter_name = self._get_counter_name()
command = ['typeperf', counter_name, '-si', str(SAMPLING_INTERVAL)]
self._popen = subprocess.Popen(' '.join(command), stdout=command_stdout, cwd=support.SAVEDCWD)
self._popen = subprocess.Popen(' '.join(command),
stdout=command_stdout,
cwd=os_helper.SAVEDCWD)
# Close our copy of the write end of the pipe
os.close(command_stdout)