From: Antoine Pitrou Date: Sat, 23 Jul 2011 20:37:52 +0000 (+0200) Subject: Issue #12624: It is now possible to fail after the first failure when X-Git-Tag: v3.3.0a1~1848 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8dbd8573e513248ca4c105d0f580f47e79ab9ec8;p=thirdparty%2FPython%2Fcpython.git Issue #12624: It is now possible to fail after the first failure when running in verbose mode (`-v` or `-W`), by using the `--failfast` (or `-G`) option to regrtest. This is useful with long test suites such as test_io or test_subprocess. --- 8dbd8573e513248ca4c105d0f580f47e79ab9ec8 diff --cc Lib/test/regrtest.py index 4444f572aab6,6fad78fc0b09..c3d2fcbf6ca9 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@@ -298,7 -276,7 +299,8 @@@ def main(tests=None, testdir=None, verb 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=', 'multiprocess=', 'coverage', 'slaveargs=', 'forever', 'debug', - 'start=', 'nowindows', 'header', 'testdir=', 'timeout=', 'wait']) - 'start=', 'nowindows', 'header', 'failfast']) ++ 'start=', 'nowindows', 'header', 'testdir=', 'timeout=', 'wait', ++ 'failfast']) except getopt.error as msg: usage(msg) @@@ -600,7 -551,7 +606,7 @@@ (test, verbose, quiet), dict(huntrleaks=huntrleaks, use_resources=use_resources, debug=debug, output_on_failure=verbose3, - timeout=timeout) - failfast=failfast) ++ timeout=timeout, failfast=failfast) ) yield (test, args_tuple) pending = tests_and_args() @@@ -685,7 -629,8 +691,8 @@@ else: try: result = runtest(test, verbose, quiet, huntrleaks, debug, - output_on_failure=verbose3, timeout=timeout) + output_on_failure=verbose3, - failfast=failfast) ++ timeout=timeout, failfast=failfast) accumulate_result(test, result) except KeyboardInterrupt: interrupted = True @@@ -829,7 -777,7 +836,7 @@@ def replace_stdout() def runtest(test, verbose, quiet, huntrleaks=False, debug=False, use_resources=None, - output_on_failure=False, timeout=None): - output_on_failure=False, failfast=False): ++ output_on_failure=False, failfast=False, timeout=None): """Run a single test. test -- the name of the test @@@ -853,10 -799,9 +860,12 @@@ if use_resources is not None: support.use_resources = use_resources + use_timeout = (timeout is not None) + if use_timeout: + faulthandler.dump_tracebacks_later(timeout, exit=True) try: + if failfast: + support.failfast = True if output_on_failure: support.verbose = True diff --cc Lib/test/support.py index 278348ec7cb6,09846a85a201..8a60ba995efd --- a/Lib/test/support.py +++ b/Lib/test/support.py @@@ -43,19 -38,21 +43,19 @@@ __all__ = "Error", "TestFailed", "ResourceDenied", "import_module", "verbose", "use_resources", "max_memuse", "record_original_stdout", "get_original_stdout", "unload", "unlink", "rmtree", "forget", - "is_resource_enabled", "requires", "requires_mac_ver", - "find_unused_port", "bind_port", - "fcmp", "is_jython", "TESTFN", "HOST", "FUZZ", "SAVEDCWD", "temp_cwd", - "findfile", "sortdict", "check_syntax_error", "open_urlresource", - "check_warnings", "CleanImport", "EnvironmentVarGuard", - "TransientResource", "captured_output", "captured_stdout", - "captured_stdin", "captured_stderr", - "time_out", "socket_peer_reset", "ioerror_peer_reset", - "run_with_locale", 'temp_umask', "transient_internet", - "set_memlimit", "bigmemtest", "bigaddrspacetest", "BasicTestRunner", - "run_unittest", "run_doctest", "threading_setup", "threading_cleanup", - "reap_children", "cpython_only", "check_impl_detail", "get_attribute", - "swap_item", "swap_attr", "requires_IEEE_754", + "is_resource_enabled", "requires", "requires_linux_version", + "requires_mac_ver", "find_unused_port", "bind_port", + "IPV6_ENABLED", "is_jython", "TESTFN", "HOST", "SAVEDCWD", "temp_cwd", + "findfile", "create_empty_file", "sortdict", "check_syntax_error", "open_urlresource", + "check_warnings", "CleanImport", "EnvironmentVarGuard", "TransientResource", + "captured_stdout", "captured_stdin", "captured_stderr", "time_out", + "socket_peer_reset", "ioerror_peer_reset", "run_with_locale", 'temp_umask', + "transient_internet", "set_memlimit", "bigmemtest", "bigaddrspacetest", + "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup", + "threading_cleanup", "reap_children", "cpython_only", "check_impl_detail", + "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754", "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink", - "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE" - "import_fresh_module", "failfast", ++ "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast", ] class Error(Exception): diff --cc Misc/NEWS index 74da5307bc4a,c7e917e045f4..cae4b8b006de --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -1087,81 -753,6 +1087,86 @@@ Extension Module Tests ----- ++- Issue #12624: It is now possible to fail after the first failure when ++ running in verbose mode (``-v`` or ``-W``), by using the ``--failfast`` ++ (or ``-G``) option to regrtest. This is useful with long test suites ++ such as test_io or test_subprocess. ++ +- Issue #12587: Correct faulty test file and reference in test_tokenize. + (Patch by Robert Xiao) + +- Issue #12573: Add resource checks for dangling Thread and Process objects. + +- Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' + as the processor type on some Mac systems. + +- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary + failure in name resolution. + +- Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and + an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder + Web site. + +- Avoid failing in test_urllibnet.test_bad_address when some overzealous + DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test + is now skipped instead. + +- Issue #12440: When testing whether some bits in SSLContext.options can be + reset, check the version of the OpenSSL headers Python was compiled against, + rather than the runtime version of the OpenSSL library. + +- Issue #11512: Add a test suite for the cgitb module. Patch by Robbie Clemons. + +- Issue #12497: Install test/data to prevent failures of the various codecmaps + tests. + +- Issue #12496: Install test/capath directory to prevent test_connect_capath + testcase failure in test_ssl. + +- Issue #12469: Run wakeup and pending signal tests in a subprocess to run the + test in a fresh process with only one thread and to not change signal + handling of the parent process. + +- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run + test_tk or test_ttk_guionly under a username that is not currently logged + in to the console windowserver (as may be the case under buildbot or ssh). + +- Issue #12407: Explicitly skip test_capi.EmbeddingTest under Windows. + +- Issue #12400: regrtest -W doesn't rerun the tests twice anymore, but captures + the output and displays it on failure instead. regrtest -v doesn't print the + error twice anymore if there is only one error. + +- Issue #12141: Install copies of template C module file so that + test_build_ext of test_distutils and test_command_build_ext of + test_packaging are no longer silently skipped when + run outside of a build directory. + +- Issue #8746: Add additional tests for os.chflags() and os.lchflags(). + Patch by Garrett Cooper. + +- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9 + 2.8 + on Mac OS X. (Patch by Ronald Oussoren) + +- Issue #12057: Add tests for ISO 2022 codecs (iso2022_jp, iso2022_jp_2, + iso2022_kr). + +- Issue #12180: Fixed a few remaining errors in test_packaging when no + threading. + +- Issue #12120, #12119: skip a test in packaging and distutils + if sys.dont_write_bytecode is set to True. + +- Issue #12096: Fix a race condition in test_threading.test_waitfor(). Patch + written by Charles-François Natali. + +- Issue #11614: import __hello__ prints "Hello World!". Patch written by + Andreas Stührk. + +- Issue #5723: Improve json tests to be executed with and without accelerations. + +- Issue #12041: Make test_wait3 more robust. + - Issue #11873: Change regex in test_compileall to fix occasional failures when when the randomly generated temporary path happened to match the regex.