]> granicus.if.org Git - python/commitdiff
Issue #23799: Added test.support.start_threads() for running and cleaning up
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 1 Apr 2015 10:06:18 +0000 (13:06 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 1 Apr 2015 10:06:18 +0000 (13:06 +0300)
multiple threads.

1  2 
Lib/test/support/__init__.py
Lib/test/test_bz2.py
Lib/test/test_capi.py
Lib/test/test_io.py
Lib/test/test_threaded_import.py
Misc/NEWS

Simple merge
Simple merge
Simple merge
index 87547795eac2290be63f4dc9bf5872a383d0099c,95277d9c4768ba6ba4e46aed721edc8e4fae8731..9fb85f21e2cc72eb6054968451f4b7323142d6b2
@@@ -3490,10 -3392,11 +3480,10 @@@ class SignalsTest(unittest.TestCase)
              # handlers, which in this case will invoke alarm_interrupt().
              signal.alarm(1)
              try:
 -                with self.assertRaises(ZeroDivisionError):
 -                    wio.write(item * (support.PIPE_MAX_SIZE // len(item) + 1))
 +                self.assertRaises(ZeroDivisionError, wio.write, large_data)
              finally:
                  signal.alarm(0)
-             t.join()
+                 t.join()
              # We got one byte, get another one and check that it isn't a
              # repeat of the first one.
              read_results.append(os.read(r, 1))
index 5bf670c8157520f82ca973d0b0968e58d088bad1,4be615a5a809434286bb9306ab312587e2ef129c..9b2d9a6f19b8b67045d977d51953c20cb1745023
@@@ -115,18 -115,12 +115,18 @@@ class ThreadedImportTests(unittest.Test
              errors = []
              done_tasks = []
              done.clear()
-             for i in range(N):
-                 t = threading.Thread(target=task,
-                                      args=(N, done, done_tasks, errors,))
-                 t.start()
 +            t0 = time.monotonic()
 -            self.assertTrue(done.wait(60))
 -            self.assertFalse(errors)
+             with start_threads(threading.Thread(target=task,
+                                                 args=(N, done, done_tasks, errors,))
+                                for i in range(N)):
+                 pass
 +            completed = done.wait(10 * 60)
 +            dt = time.monotonic() - t0
 +            if verbose:
 +                print("%.1f ms" % (dt*1e3), flush=True, end=" ")
 +            dbg_info = 'done: %s/%s' % (len(done_tasks), N)
 +            self.assertFalse(errors, dbg_info)
 +            self.assertTrue(completed, dbg_info)
              if verbose:
                  print("OK.")
  
diff --cc Misc/NEWS
index 76b7ef7a2f6b114f1eec9966fce714de98793384,33fc0ee3b0267e380b2d5ef908140ef267cda986..6b63fdc55302c4682cdb6a629154172cfe78d7b0
+++ b/Misc/NEWS
@@@ -218,61 -79,6 +218,64 @@@ Librar
  - Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with
    imp.reload().  Patch by Thomas Kluyver.
  
 +- Issue #23605: os.walk() now calls os.scandir() instead of os.listdir().
 +  The usage of os.scandir() reduces the number of calls to os.stat().
 +  Initial patch written by Ben Hoyt.
 +
 +Build
 +-----
 +
 +- Issue #23585: make patchcheck will ensure the interpreter is built.
 +
 +Tests
 +-----
 +
++- Issue #23799: Added test.support.start_threads() for running and
++  cleaning up multiple threads.
++
 +- Issue #22390: test.regrtest now emits a warning if temporary files or
 +  directories are left after running a test.
 +
 +- Issue #23583: Added tests for standard IO streams in IDLE.
 +
 +- Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout.
 +
 +Tools/Demos
 +-----------
 +
 +- Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better
 +  compatible with regular files (in particular it now supports the context
 +  management protocol).
 +
 +
 +What's New in Python 3.5 alpha 2?
 +=================================
 +
 +Release date: 2015-03-09
 +
 +Core and Builtins
 +-----------------
 +
 +- Issue #22980: Under Linux, C extensions now include bitness in the file
 +  name, to make it easy to test 32-bit and 64-bit builds in the same
 +  working tree.
 +
 +- Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError
 +  if a function returns a result and raises an exception. The SystemError is
 +  chained to the previous exception.
 +
 +Library
 +-------
 +
 +- Issue #22524: New os.scandir() function, part of the PEP 471: "os.scandir()
 +  function -- a better and faster directory iterator". Patch written by Ben
 +  Hoyt.
 +
 +- Issue #23103: Reduced the memory consumption of IPv4Address and IPv6Address.
 +
 +- Issue #21793: BaseHTTPRequestHandler again logs response code as numeric,
 +  not as stringified enum.  Patch by Demian Brecht.
 +
  - Issue #23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST
    flag on certificate stores when it is available.