From ec882214fe84b1affeeafb324ac682cc1f6a4a69 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 9 Aug 2010 16:56:43 +0000 Subject: Merged manually from 2.7 branch to 3.x trunk. ------------------------------------------------------------------------ r80411 | florent.xicluna | 2010-04-23 19:59:10 +0200 (ven. 23 avril 2010) | 2 lignes Remove ImportWarnings filters. They become obsolete after r79310, issue #8205. ------------------------------------------------------------------------ r80412 | florent.xicluna | 2010-04-23 20:10:12 +0200 (ven. 23 avril 2010) | 2 lignes Fix the "regrtest -s" switch. ------------------------------------------------------------------------ r81140 | florent.xicluna | 2010-05-13 19:05:29 +0200 (jeu. 13 mai 2010) | 3 lignes Add sensible information about the OS X platform to diagnose issue #8423: test_pep277 fails on "x86 Tiger" buildbot but not on "PPC Tiger". ------------------------------------------------------------------------ r81141 | florent.xicluna | 2010-05-13 20:16:06 +0200 (jeu. 13 mai 2010) | 2 lignes Revert the additional OS X information (r81140). Keep the endianness information. ------------------------------------------------------------------------ --- Lib/test/regrtest.py | 27 ++++++++++----------------- 1 file 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 -- cgit v0.12