diff options
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/regrtest.py | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index f3f3553..48bfb5b 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -187,14 +187,6 @@ for module in sys.modules.values(): module.__file__ = os.path.abspath(module.__file__) -# Ignore ImportWarnings that only occur in the source tree, -# (because of modules with the same name as source-directories in Modules/) -for mod in ("ctypes", "gzip", "zipfile", "tarfile", "encodings.zlib_codec", - "test.test_zipimport", "test.test_zlib", "test.test_zipfile", - "test.test_codecs", "test.string_tests"): - warnings.filterwarnings(module=".*%s$" % (mod,), - action="ignore", category=ImportWarning) - # MacOSX (a.k.a. Darwin) has a default stack size that is too small # for deeply recursive regular expressions. We see this as crashes in # the Python test suite when running test_re.py and test_sre.py. The @@ -224,6 +216,7 @@ from test import support RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'decimal', 'compiler', 'subprocess', 'urlfetch', 'gui') +TEMPDIR = os.path.abspath(tempfile.gettempdir()) def usage(msg): print(msg, file=sys.stderr) @@ -423,7 +416,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, found_garbage = [] if single: - filename = 'pynexttest' + filename = os.path.join(TEMPDIR, 'pynexttest') try: fp = open(filename, 'r') next_test = fp.read().strip() @@ -455,10 +448,11 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, args = [] # For a partial run, we do not need to clutter the output. - if verbose or not (quiet or tests or args): + if verbose or not (quiet or single or tests or args): # Print basic platform information print("==", platform.python_implementation(), *sys.version.split()) - print("== ", platform.platform(aliased=True)) + print("== ", platform.platform(aliased=True), + "%s-endian" % sys.byteorder) print("== ", os.getcwd()) alltests = findtests(testdir, stdtests, nottests) @@ -1461,18 +1455,17 @@ if __name__ == '__main__': # to keep the test files in a subfolder. It eases the cleanup of leftover # files using command "make distclean". if sysconfig.is_python_build(): - parent_dir = os.path.join(sysconfig.get_config_var('srcdir'), 'build') - if not os.path.exists(parent_dir): - os.mkdir(parent_dir) - else: - parent_dir = os.path.abspath(tempfile.gettempdir()) + TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build') + TEMPDIR = os.path.abspath(TEMPDIR) + if not os.path.exists(TEMPDIR): + os.mkdir(TEMPDIR) # Define a writable temp dir that will be used as cwd while running # the tests. The name of the dir includes the pid to allow parallel # testing (see the -j option). TESTCWD = 'test_python_{}'.format(os.getpid()) - TESTCWD = os.path.join(parent_dir, TESTCWD) + TESTCWD = os.path.join(TEMPDIR, TESTCWD) # Run the tests in a context manager that temporary changes the CWD to a # temporary and writable directory. If it's not possible to create or |