]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #12624: It is now possible to fail after the first failure when
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 23 Jul 2011 20:37:52 +0000 (22:37 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 23 Jul 2011 20:37:52 +0000 (22:37 +0200)
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.

1  2 
Lib/test/regrtest.py
Lib/test/support.py
Misc/NEWS

index 4444f572aab61b3339764380f810e3fdd4f2b5ab,6fad78fc0b0991511b7e90a925edd770c3639875..c3d2fcbf6ca926a159886ababddaaecfafad6c50
@@@ -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)
  
                      (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()
              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
  
      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
  
index 278348ec7cb65808a98d11667e4683bf1df2303e,09846a85a2019e3dbb2fde51f2e0a1513c30724a..8a60ba995efd5bf1d21de3d4103c1cc7b8f92881
@@@ -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 74da5307bc4a9125cec21093e95daef70d6d283d,c7e917e045f412f1285824da316f1dcb6bb8eb04..cae4b8b006dee8d6f02ca8b8e2f688c9e5e7f658
+++ 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.