From: Serhiy Storchaka Date: Wed, 1 Apr 2015 10:06:18 +0000 (+0300) Subject: Issue #23799: Added test.support.start_threads() for running and cleaning up X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c05e260ecb822431cf5bdcd02b7cb0f4cfc88f6b;p=python Issue #23799: Added test.support.start_threads() for running and cleaning up multiple threads. --- c05e260ecb822431cf5bdcd02b7cb0f4cfc88f6b diff --cc Lib/test/test_io.py index 87547795ea,95277d9c47..9fb85f21e2 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@@ -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)) diff --cc Lib/test/test_threaded_import.py index 5bf670c815,4be615a5a8..9b2d9a6f19 --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@@ -115,18 -115,12 +115,18 @@@ class ThreadedImportTests(unittest.Test errors = [] done_tasks = [] done.clear() + t0 = time.monotonic() - for i in range(N): - t = threading.Thread(target=task, - args=(N, done, done_tasks, errors,)) - t.start() + with start_threads(threading.Thread(target=task, + args=(N, done, done_tasks, errors,)) + for i in range(N)): + pass - self.assertTrue(done.wait(60)) - self.assertFalse(errors) + 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 76b7ef7a2f,33fc0ee3b0..6b63fdc553 --- a/Misc/NEWS +++ 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.