Commit Graph

72 Commits

Author SHA1 Message Date
Yury Selivanov 9818142b1b
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877) 2017-12-18 20:02:54 -05:00
Victor Stinner b9b69003d9 bpo-31234: Add support.join_thread() helper (#3587)
join_thread() joins a thread but raises an AssertionError if the
thread is still alive after timeout seconds.
2017-09-14 14:40:56 -07:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Nir Soffer c648a93ae3 bpo-30980: Fix double close in asyncore.file_wrapper (#2789)
* bpo-30980: Fix close test to fail

test_close_twice was not considering the fact that file_wrapper is
duping the file descriptor. Closing the original descriptor left the
duped one open, hiding the fact that close protection is not effective.

* bpo-30980: Fix double close protection

Invalidated self.fd before closing, handling correctly the case when
os.close raises.

* bpo-30980: Fix fd leak introduced in the fixed test
2017-07-24 23:18:06 +02:00
Victor Stinner a2c877c398 bpo-30106: Fix test_asyncore.test_quick_connect() (#1234)
test_quick_connect() runs a thread up to 50 seconds, whereas the
socket is connected in 0.2 second and then the thread is expected to
end in less than 3 second. On Linux, the thread ends quickly because
select() seems to always return quickly. On FreeBSD, sometimes
select() fails with timeout and so the thread runs much longer than
expected.

Fix the thread timeout to fix a race condition in the test.
2017-04-21 13:51:53 +02:00
Victor Stinner 11470b6dcd bpo-30106: Fix tearDown() of test_asyncore (#1194)
Call asyncore.close_all() with ignore_all=True in the tearDown()
method of the test_asyncore base test case. It should prevent keeping
alive sockets in asyncore.socket_map if close() fails with an
unexpected error.

Revert also an unwanted change of my previous commit: remove name
parameter of Thread in test_quick_connect().
2017-04-20 02:55:39 +02:00
Victor Stinner 7b9619ae24 Fix/optimize test_asyncore.test_quick_connect() (#1188)
Don't use addCleanup() in test_quick_connect() because it keeps the
Thread object alive and so @reap_threads fails on its timeout of 1
second. "./python -m test -v test_asyncore -m test_quick_connect"
now takes 185 ms, instead of 11 seconds.

Other minor changes:

* Use "with sock:" to close the socket instead of
  try/finally: sock.close()
* Use self.skipTest() in test_quick_connect() to remove one
  indentation level and notice user that the test is specific to
  AF_INET and AF_INET6
2017-04-19 23:42:46 +02:00
Ned Deily de04644627 bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. (#462)
* bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS

Skip some tests of select.poll when running on macOS due to unresolved
issues with the underlying system poll function on some macOS versions.
2017-03-04 06:00:37 -05:00
Xavier de Gaye e88ed05006 Issue #28683: Fix the tests that bind() a unix socket and raise PermissionError
on Android for a non-root user.
2016-12-14 11:52:28 +01:00
Steve Dower 22d0698d3b Adds test.support.PGO and skips tests that are not useful for PGO. 2016-09-06 19:38:15 -07:00
Victor Stinner 1bcab66811 (Merge 3.4) Issue #11453, #18174: Fix leak of file descriptor in test_asyncore 2014-07-29 01:01:43 +02:00
Victor Stinner 623138c163 Issue #11453, #18174: Fix leak of file descriptor in test_asyncore 2014-07-29 01:01:09 +02:00
Charles-François Natali 6e20460dc6 Issue #21566: Make use of socket.listen() default backlog. 2014-07-23 19:28:13 +01:00
Victor Stinner a81088ae12 (Merge 3.4) Issue #11453: asyncore: emit a ResourceWarning when an unclosed
file_wrapper object is destroyed. The destructor now closes the file if needed.
The close() method can now be called twice: the second call does nothing.
2014-06-27 23:57:19 +02:00
Victor Stinner 4d4c69dc35 Issue #11453: asyncore: emit a ResourceWarning when an unclosed file_wrapper
object is destroyed. The destructor now closes the file if needed. The close()
method can now be called twice: the second call does nothing.
2014-06-27 23:52:03 +02:00
Victor Stinner c3bc856f42 (Merge 3.4) Closes #21582: Cleanup test_asyncore. Patch written by diana.
- Use support.captured_stderr() where appropriate
- Removes some "from test.support import xxx" import and uses support.xxx
  instead.
2014-06-27 22:47:41 +02:00
Victor Stinner 252d40ef1e Closes #21582: Cleanup test_asyncore. Patch written by diana.
- Use support.captured_stderr() where appropriate
- Removes some "from test.support import xxx" import and uses support.xxx
  instead.
2014-06-27 22:44:40 +02:00
Giampaolo Rodola' 8af740c46a fix isuse #13248: remove previously deprecated asyncore.dispatcher __getattr__ cheap inheritance hack. 2014-04-29 02:03:40 +02:00
Antoine Pitrou 0f1155c6cc Issue #7221: remove redundant tests in test_asyncore. Patch by Jessica McKellar. 2014-04-19 21:07:16 +02:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Antoine Pitrou f6fbf56071 Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since "localhost" goes through a DNS lookup under recent Windows versions. 2013-08-22 00:39:46 +02:00
Giampaolo Rodola' 3cb09064a3 Issue #17992: Add timeouts to asyncore and asynchat tests so that they won't accidentally hang. 2013-05-16 15:21:53 +02:00
Charles-François Natali adbfcb83a2 test_asyncore: wait explicitly for a thread termination (this dangling thread
could be the cause of a random failure).
2013-01-13 14:12:35 +01:00
Charles-François Natali 1ea12ff04d test_asyncore: wait explicitly for a thread termination (this dangling thread
could be the cause of a random failure).
2013-01-13 14:08:01 +01:00
Charles-François Natali ce1519d250 test_asyncore: wait explicitly for a thread termination (this dangling thread
could be the cause of a random failure).
2013-01-13 13:56:52 +01:00
Ezio Melotti af5b688f71 #16896: merge with 3.3. 2013-01-10 05:29:33 +02:00
Ezio Melotti 47236db1d0 #16896: test_asyncore now works with unittest test discovery. Patch by Zachary Ware. 2013-01-10 05:28:52 +02:00
Andrew Svetlov 0832af6628 Issue #16717: get rid of socket.error, replace with OSError 2012-12-18 23:10:48 +02:00
Kristján Valur Jónsson b2e58185e5 Set a time threshold in test_asyncore.capture_server so that tests don't
deadlock if the main thread fails before sending all the data.
2012-04-06 14:37:45 +00:00
Giampaolo Rodola' c7ea19fee8 attempt to fix asyncore buildbot failure 2012-03-23 15:09:58 +01:00
Giampaolo Rodola' a3481e70d1 attempt to fix asyncore buildbot failure 2012-03-23 15:07:07 +01:00
Giampaolo Rodola' 466a54f4dc fix failing asyncore test as per http://bugs.python.org/issue10340#msg156586 2012-03-23 13:29:01 +01:00
Giampaolo Rodola' 3539ef3d21 merge 79422b3684f1 in 3.3 branch (issue 10340) 2012-03-22 16:19:45 +01:00
Giampaolo Rodola' 350c94b900 fix #10340: properly handle EINVAL on OSX and also avoid to call handle_connect() in case of a disconnetected socket which is not meant to connect. 2012-03-22 16:17:43 +01:00
Charles-François Natali cf85c300cf test_asyncore: Actually try to received OOB data. 2011-11-02 20:30:59 +01:00
Charles-François Natali 39648d11ab test_asyncore: Enable tests of Unix domain sockets with poll(). 2011-10-31 12:08:09 +01:00
Charles-François Natali fea6cb0285 Issue #5661: on EPIPE/ECONNRESET, OS X returns the FD with the POLLPRI flag... 2011-10-29 14:29:39 +02:00
Charles-François Natali d4621190c9 Issue #5661: Add a test for ECONNRESET/EPIPE handling to test_asyncore. Patch
by Xavier de Gaye.
2011-10-29 12:45:56 +02:00
Charles-François Natali a045c05878 Issue #12656: Really fix test_asyncore failures on Windows buildbots... 2011-08-25 01:22:50 +02:00
Charles-François Natali e3540b47d1 Issue #12656: Fix test_asyncore failures on Windows buildbots. 2011-08-25 00:50:41 +02:00
Charles-François Natali e78cbecaf1 Issue #12656: Add tests for IPv6 and Unix sockets to test_asyncore. 2011-08-24 23:24:05 +02:00
Giampaolo Rodolà 103a6d6cd6 Issue 11177: asyncore's create_socket() arguments can now be omitted. 2011-02-25 22:21:22 +00:00
Giampaolo Rodolà 31c44031f8 Merged revisions 88604 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88604 | giampaolo.rodola | 2011-02-25 21:05:48 +0100 (ven, 25 feb 2011) | 1 line

  (issue 11214) - fix asyncore.strerror test failure on AIX
........
2011-02-25 20:07:25 +00:00
Giampaolo Rodolà d2751fb482 (issue 11214) - fix asyncore.strerror test failure on AIX 2011-02-25 20:05:48 +00:00
Ezio Melotti ed3a7d2d60 #10273: Rename assertRegexpMatches and assertRaisesRegexp to assertRegex and assertRaisesRegex. 2010-12-01 02:32:32 +00:00
Benjamin Peterson d6868b4ed4 fix leaking sockets 2010-10-31 17:34:34 +00:00
Brett Cannon 2d562f8081 have test_asyncore properly close files. 2010-10-29 22:40:44 +00:00
Antoine Pitrou b1c5496738 Issue #7523: Add SOCK_CLOEXEC and SOCK_NONBLOCK to the socket module,
where supported by the system.  Patch by Nikita Vetoshkin.
2010-10-14 15:05:38 +00:00
Giampaolo Rodolà 977c707b42 Fix issue 6706: adds new handle_accepted() method to asyncore.dispatcher 2010-10-04 21:08:36 +00:00
Georg Brandl cbb0ae4a42 #9354: Provide getsockopt() in asyncore file_wrapper(). Patch by Lukas Langa. 2010-07-28 08:19:35 +00:00