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.
  ------------------------------------------------------------------------
This commit is contained in:
Florent Xicluna 2010-08-09 16:56:43 +00:00
parent da3b5bf3d8
commit ec882214fe
1 changed files with 10 additions and 17 deletions

View File

@ -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