summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socketserver.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43843: libregrtest uses threading.excepthook (GH-25400)Victor Stinner2021-04-161-2/+5
| | | | | | | | | test.libregrtest now marks a test as ENV_CHANGED (altered the execution environment) if a thread raises an exception but does not catch it. It sets a hook on threading.excepthook. Use --fail-env-changed option to mark the test as failed. libregrtest regrtest_unraisable_hook() explicitly flushs sys.stdout, sys.stderr and sys.__stderr__.
* bpo-37193: Remove thread objects which finished process its request (GH-23127)Jason R. Coombs2020-12-311-0/+23
| | | This reverts commit aca67da4fe68d5420401ac1782203d302875eb27.
* Revert "bpo-37193: remove thread objects which finished process its request ↵Jason R. Coombs2020-11-021-24/+0
| | | | | (GH-13893)" (GH-23107) This reverts commit c41559021213cfc9dc62a83fc63306b3bdc3e64b.
* bpo-37193: remove thread objects which finished process its request (GH-13893)MARUYAMA Norihiro2020-11-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-37193: remove the thread which finished process request from threads list * rename variable t to thread. * don't remove thread from list if it is daemon. * use lock to protect self._threads. * use finally block in case of exception from shutdown_request(). * check "not thread.daemon" before lock to avoid holding the lock if it's unnecessary. * fix the place of _threads_lock. * separate code to remove a current thread into a function. * check ValueError when removing thread. * fix wrong code which all instance shared same lock. * Extract thread management into a _Threads class to encapsulate atomic operations and separate concerns. * Replace multiple references of 'block_on_close' with one, avoiding the possibility that 'block_on_close' could change during the course of processing requests. Now, there's exactly one _threads object with behavior fixed for the duration. * Add docstrings to private classes. * Add test to ensure that a ThreadingTCPServer can be closed without serving any requests. * Use _NoThreads as the default value. Fixes AttributeError when server is closed without serving any requests. * Add blurb * Add test capturing failure. Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-40275: Use new test.support helper submodules in tests (GH-21743)Hai Shi2020-08-061-4/+5
|
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-271-3/+4
|
* bpo-40275: Avoid importing socket in test.support (GH-19603)Serhiy Storchaka2020-04-251-1/+2
| | | | | | * Move socket related functions from test.support to socket_helper. * Import socket, nntplib and urllib.error lazily in transient_internet(). * Remove importing multiprocess.
* bpo-40094: Add test.support.wait_process() (GH-19254)Victor Stinner2020-03-311-3/+1
| | | | | | | | | Moreover, the following tests now check the child process exit code: * test_os.PtyTests * test_mailbox.test_lock_conflict() * test_tempfile.test_process_awareness() * test_uuid.testIssue8621() * multiprocessing resource tracker tests
* bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566)Victor Stinner2019-12-111-1/+1
| | | | | | | | | | | | | | | Replace hardcoded timeout constants in tests with SHORT_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. SHORT_TIMEOUT is 30 seconds by default, but it can be longer depending on --timeout command line option. The change makes almost all timeouts longer, except test_reap_children() of test_support which is made 2x shorter: SHORT_TIMEOUT should be enough. If this test starts to fail, LONG_TIMEOUT should be used instead. Uniformize also "from test import support" import in some test files.
* bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929)Serhiy Storchaka2019-03-051-19/+17
|
* bpo-29184: Skip test_socketserver tests on PermissionError raised by Android ↵xdegaye2017-11-181-5/+14
| | | | (GH-4387)
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-8/+2
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-31151: Add socketserver.ForkingMixIn.server_close() (#3057)Victor Stinner2017-08-101-4/+5
| | | | | | | | | * Add socketserver.ForkingMixIn.server_close() bpo-31151: socketserver.ForkingMixIn.server_close() now waits until all child processes completed to prevent leaking zombie processes. * Fix test on Windows which doesn't have ForkingMixIn
* Use sequence repetition instead of bytes constructor with integer argument.Serhiy Storchaka2016-09-111-1/+1
|
* Issue #26721: Change StreamRequestHandler.wfile to BufferedIOBaseMartin Panter2016-06-291-0/+79
|
* Issue25931: fix tests broken by the conditional define of socketserver.Forking*Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-06-031-6/+7
|
* Issue #23277: Remove unused imports in tests.Serhiy Storchaka2016-04-241-2/+0
|
* Issue #26404: Add context manager to socketserver, by Aviv PalivodaMartin Panter2016-04-131-1/+6
|
* Issue #5824: Merge socketserver tests from 3.5Martin Panter2016-02-241-21/+20
|\
| * Issue #5824: Fix DatagramRequestHandler tests by binding the client socketMartin Panter2016-02-241-21/+20
| |
* | Issue #23430: Stop socketserver from catching SystemExit etc from handlersMartin Panter2016-02-211-0/+92
|/ | | | | Also make handle_error() consistently output to stderr, and fix the documentation.
* Issue #26309: Rewrite test in main thread and avoid race conditionMartin Panter2016-02-191-24/+21
|
* Issue #26309: Shut down socketserver request if verify_request() is falseMartin Panter2016-02-181-0/+24
| | | | Patch by Aviv Palivoda.
* Issue #23254: Document how to close the TCPServer listening socket.Robert Collins2015-07-291-0/+1
|\ | | | | | | Patch from Martin Panter.
| * Issue #23254: Document how to close the TCPServer listening socket.Robert Collins2015-07-291-0/+1
| | | | | | | | Patch from Martin Panter.
* | Issue #23358: Add missing BaseServer entry to socketserver.__all__.Berker Peksag2015-02-031-7/+12
|\ \ | |/ | | | | Patch by Martin Panter.
| * Issue #23358: Add missing BaseServer entry to socketserver.__all__.Berker Peksag2015-02-031-7/+12
| | | | | | | | Patch by Martin Panter.
* | Issue #22435: Fix a file descriptor leak when SocketServer bind fails.Charles-François Natali2014-10-131-0/+10
|\ \ | |/
| * Issue #22435: Fix a file descriptor leak when SocketServer bind fails.Charles-François Natali2014-10-131-0/+10
| |
* | Issue #21040: socketserver: Use the selectors module.Charles-François Natali2014-03-241-32/+0
|/
* Issue #18702: All skipped tests now reported as skipped.Serhiy Storchaka2013-11-031-39/+46
|
* Issue #17177: The imp module is pending deprecation.Brett Cannon2013-06-161-1/+1
| | | | | | To make sure there is no issue with code that is both Python 2 and 3 compatible, there are no plans to remove the module any sooner than Python 4 (unless the community moves to Python 3 solidly before then).
* Issue #16706: get rid of os.errorAndrew Svetlov2012-12-181-1/+1
|
* Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-181-1/+1
|\ | | | | | | Patch by Serhiy Storchaka.
| * Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-181-1/+1
| |\ | | | | | | | | | Patch by Serhiy Storchaka.
| | * Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-181-1/+1
| | | | | | | | | | | | Patch by Serhiy Storchaka.
| | * Fix the patch for issue #7978: select() raises select.error before 3.3, not ↵Antoine Pitrou2012-04-081-1/+1
| |/ | | | | | | OSError.
* | #16135: Removal of OS/2 support (Remove OS2 and OS/2 references)Jesus Cea2012-10-051-15/+1
|/
* Fix flakiness in test_socketserverAntoine Pitrou2012-04-081-1/+4
|
* Issue #7978: socketserver now restarts the select() call when EINTR is returned.Antoine Pitrou2012-04-081-0/+34
| | | | | This avoids crashing the server loop when a signal is received. Patch by Jerzy Kozera.
* Closes #13140: Fix the daemon_threads attribute of ThreadingMixIn.Florent Xicluna2011-11-041-1/+0
|
* Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20Victor Stinner2011-07-141-2/+1
| | | | | test_shutdown() may fail on very slow buildbots like FreeBSD 6.4 just because of the arbitrary timeout.
* test_sockserver: close servers when doneVictor Stinner2011-01-031-0/+2
|
* #9424: Replace deprecated assert* methods in the Python test suite.Ezio Melotti2010-11-201-5/+5
|
* Merged revisions 81543 via svnmerge fromVictor Stinner2010-05-261-0/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81543 | victor.stinner | 2010-05-26 19:25:28 +0200 (mer., 26 mai 2010) | 2 lines Issue #7449: Skip test_socketserver if threading support is disabled ........
* Merged revisions 80552-80556,80564-80566,80568-80571 via svnmerge fromVictor Stinner2010-04-281-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r80552 | victor.stinner | 2010-04-27 23:46:03 +0200 (mar., 27 avril 2010) | 3 lines Issue #7449, part 1: fix test_support.py for Python compiled without thread ........ r80553 | victor.stinner | 2010-04-27 23:47:01 +0200 (mar., 27 avril 2010) | 1 line Issue #7449, part 2: regrtest.py -j option requires thread support ........ r80554 | victor.stinner | 2010-04-27 23:51:26 +0200 (mar., 27 avril 2010) | 9 lines Issue #7449 part 3, test_doctest: import trace module in test_coverage() Import trace module fail if the threading module is missing. test_coverage() is only used if test_doctest.py is used with the -c option. This commit allows to execute the test suite without thread support. Move "import trace" in test_coverage() and use test_support.import_module('trace'). ........ r80555 | victor.stinner | 2010-04-27 23:56:26 +0200 (mar., 27 avril 2010) | 6 lines Issue #7449, part 4: skip test_multiprocessing if thread support is disabled import threading after _multiprocessing to raise a more revelant error message: "No module named _multiprocessing". _multiprocessing is not compiled without thread support. ........ r80556 | victor.stinner | 2010-04-28 00:01:24 +0200 (mer., 28 avril 2010) | 8 lines Issue #7449, part 5: split Test.test_open() of ctypes/test/test_errno.py * Split Test.test_open() in 2 functions: test_open() and test_thread_open() * Skip test_open() and test_thread_open() if we are unable to find the C library * Skip test_thread_open() if thread support is disabled * Use unittest.skipUnless(os.name == "nt", ...) on test_GetLastError() ........ r80564 | victor.stinner | 2010-04-28 00:59:35 +0200 (mer., 28 avril 2010) | 4 lines Issue #7449, part 6: fix test_hashlib for missing threading module Move @test_support.reap_thread decorator from test_main() to test_threaded_hashing(). ........ r80565 | victor.stinner | 2010-04-28 01:01:29 +0200 (mer., 28 avril 2010) | 6 lines Issue #7449, part 7: simplify threading detection in test_capi * Skip TestPendingCalls if threading module is missing * Test if threading module is present or not, instead of test the presence of _testcapi._test_thread_state ........ r80566 | victor.stinner | 2010-04-28 01:03:16 +0200 (mer., 28 avril 2010) | 4 lines Issue #7449, part 8: don't skip the whole test_asynchat if threading is missing TestFifo can be executed without the threading module ........ r80568 | victor.stinner | 2010-04-28 01:14:58 +0200 (mer., 28 avril 2010) | 6 lines Issue #7449, part 9: fix test_xmlrpclib for missing threading module * Skip testcases using threads if threading module is missing * Use "http://" instead of URL in ServerProxyTestCase if threading is missing because URL is not set in this case ........ r80569 | victor.stinner | 2010-04-28 01:33:58 +0200 (mer., 28 avril 2010) | 6 lines Partial revert of r80556 (Issue #7449, part 5, fix ctypes test) Rewrite r80556: the thread test have to be executed just after the test on libc_open() and so the test cannot be splitted in two functions (without duplicating code, and I don't want to duplicate code). ........ r80570 | victor.stinner | 2010-04-28 01:51:16 +0200 (mer., 28 avril 2010) | 8 lines Issue #7449, part 10: test_cmd imports trace module using test_support.import_module() Use test_support.import_module() instead of import to raise a SkipTest exception if the import fail. Import trace fails if the threading module is missing. See also part 3: test_doctest: import trace module in test_coverage(). ........ r80571 | victor.stinner | 2010-04-28 01:55:59 +0200 (mer., 28 avril 2010) | 6 lines Issue #7449, last part (11): fix many tests if thread support is disabled * Use try/except ImportError or test_support.import_module() to import thread and threading modules * Add @unittest.skipUnless(threading, ...) to testcases using threads ........
* Merged revisions 80484 via svnmerge fromAntoine Pitrou2010-04-251-0/+25
| | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r80484 | antoine.pitrou | 2010-04-25 23:40:32 +0200 (dim., 25 avril 2010) | 6 lines Issue #2302: Fix a race condition in SocketServer.BaseServer.shutdown, where the method could block indefinitely if called just before the event loop started running. This also fixes the occasional freezes witnessed in test_httpservers. ........
* Merged revisions 78093 via svnmerge fromGeorg Brandl2010-03-141-3/+0
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line Remove unused imports in test modules. ........
* Merged revisions 75874 via svnmerge fromAntoine Pitrou2009-10-271-1/+2
| | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r75874 | antoine.pitrou | 2009-10-27 22:27:24 +0100 (mar., 27 oct. 2009) | 4 lines Reduce the probability of refleaks in test_socketserver. Not completely suppressed though, see issue #7222. ........
* Merged revisions ↵Benjamin Peterson2009-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 70554,70588-70589,70598,70605,70611-70621,70623-70624,70626-70627 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70554 | benjamin.peterson | 2009-03-23 16:25:15 -0500 (Mon, 23 Mar 2009) | 1 line complain when there's no last exception ........ r70588 | benjamin.peterson | 2009-03-24 17:56:32 -0500 (Tue, 24 Mar 2009) | 1 line fix newline issue in test summary ........ r70589 | benjamin.peterson | 2009-03-24 18:07:07 -0500 (Tue, 24 Mar 2009) | 1 line another style nit ........ r70598 | benjamin.peterson | 2009-03-25 16:24:04 -0500 (Wed, 25 Mar 2009) | 1 line add shorthands for expected failures and unexpected success ........ r70605 | benjamin.peterson | 2009-03-26 11:32:23 -0500 (Thu, 26 Mar 2009) | 1 line remove uneeded function ........ r70611 | benjamin.peterson | 2009-03-26 13:35:37 -0500 (Thu, 26 Mar 2009) | 1 line add much better tests for python version information parsing ........ r70612 | benjamin.peterson | 2009-03-26 13:55:48 -0500 (Thu, 26 Mar 2009) | 1 line more and more implementations now support sys.subversion ........ r70613 | benjamin.peterson | 2009-03-26 13:58:30 -0500 (Thu, 26 Mar 2009) | 1 line roll old test in with new one ........ r70614 | benjamin.peterson | 2009-03-26 14:09:21 -0500 (Thu, 26 Mar 2009) | 1 line add support for PyPy ........ r70615 | benjamin.peterson | 2009-03-26 14:58:18 -0500 (Thu, 26 Mar 2009) | 5 lines add some useful utilities for skipping tests with unittest's new skipping ability most significantly apply a modified portion of the patch from #4242 with patches for skipping implementation details ........ r70616 | benjamin.peterson | 2009-03-26 15:05:50 -0500 (Thu, 26 Mar 2009) | 1 line rename TestCase.skip() to skipTest() because it causes annoying problems with trial #5571 ........ r70617 | benjamin.peterson | 2009-03-26 15:17:27 -0500 (Thu, 26 Mar 2009) | 1 line apply the second part of #4242's patch; classify all the implementation details in test_descr ........ r70618 | benjamin.peterson | 2009-03-26 15:48:25 -0500 (Thu, 26 Mar 2009) | 1 line remove test_support.TestSkipped and just use unittest.SkipTest ........ r70619 | benjamin.peterson | 2009-03-26 15:49:40 -0500 (Thu, 26 Mar 2009) | 1 line fix naming ........ r70620 | benjamin.peterson | 2009-03-26 16:10:30 -0500 (Thu, 26 Mar 2009) | 1 line fix incorrect auto-translation of TestSkipped -> unittest.SkipTest ........ r70621 | benjamin.peterson | 2009-03-26 16:11:16 -0500 (Thu, 26 Mar 2009) | 1 line must pass argument to get expected behavior ;) ........ r70623 | benjamin.peterson | 2009-03-26 16:30:10 -0500 (Thu, 26 Mar 2009) | 1 line add missing import ........ r70624 | benjamin.peterson | 2009-03-26 16:30:54 -0500 (Thu, 26 Mar 2009) | 1 line ** is required here ........ r70626 | benjamin.peterson | 2009-03-26 16:40:29 -0500 (Thu, 26 Mar 2009) | 1 line update email tests to use SkipTest ........ r70627 | benjamin.peterson | 2009-03-26 16:44:43 -0500 (Thu, 26 Mar 2009) | 1 line fix another name ........