Commit Graph

40 Commits

Author SHA1 Message Date
Hai Shi 490c5426b1
bpo-40275: Fix failed test cases by using test helpers (GH-21811) 2020-08-10 23:24:02 +02:00
Serhiy Storchaka 16994912c9
bpo-40275: Avoid importing socket in test.support (GH-19603)
* Move socket related functions from test.support to socket_helper.
* Import socket, nntplib and urllib.error lazily in transient_internet().
* Remove importing multiprocess.
2020-04-25 10:06:29 +03:00
Russell Davis ba1bcffe5c
bpo-29255: Wait in KqueueSelector.select when no fds are registered (GH-19508)
Also partially fixes bpo-25680 (there's still a discrepancy in behavior
on Windows that needs to be fixed).
2020-04-15 11:57:06 -07:00
Steve Dower e5f41d2f1e
bpo-33522: Enable CI builds on Visual Studio Team Services (#6865) 2018-05-16 17:50:29 -04:00
Victor Stinner 9abee722d4 bpo-31479: Always reset the signal alarm in tests (#3588)
* bpo-31479: Always reset the signal alarm in tests

Use "try: ... finally: signal.signal(0)" pattern to make sure that
tests don't "leak" a pending fatal signal alarm.

* Move two more alarm() calls into the try block

Fix also typo: replace signal.signal(0) with signal.alarm(0)

* Move another signal.alarm() into the try block
2017-09-19 09:36:54 -07:00
Giampaolo Rodola fbfaa6fd57 bpo-30014: make poll-like selector's modify() method faster (#1030)
* #30014: make selectors.DefaultSelector.modify() faster by relying on selector's modify() method instead of un/register()ing the fd

* #30014: add unit test

* speedup poll/epoll/devpoll modify() method by using internal modify() call

* update doc

* address PR comments

* update NEWS entries

* use != instead of 'is not'
2017-06-09 22:20:41 +02:00
Yury Selivanov 525aedc5fa Issue #27759: Fix selectors incorrectly retain invalid file descriptors.
Patch by Mark Williams.
2016-09-15 19:30:42 -04:00
Victor Stinner b310173319 Issue #23485: Enhance and update selectors doc and test_selectors
Selector.select() is now retried with the recomputed timeout when interrupted
by a signal.

Write an unit test with a signal handler raising an exception, and a unit with
a signal handler which does not raise an exception (it does nothing).
2015-03-31 12:08:09 +02:00
Victor Stinner f07717c105 Merge 3.4 2015-01-22 09:09:24 +01:00
Victor Stinner 14d45c06eb Issue #23009: Skip test_selectors.test_empty_select() on Windows 2015-01-22 09:07:36 +01:00
Victor Stinner 458fc6f98c Issue #23209, #23225: selectors.BaseSelector.get_key() now raises a
RuntimeError if the selector is closed. And selectors.BaseSelector.close() now
clears its internal reference to the selector mapping to break a reference
cycle. Initial patch written by Martin Richard.
2015-01-13 10:00:55 +01:00
Victor Stinner 38dc250521 Issue #23209, #23225: selectors.BaseSelector.close() now clears its internal
reference to the selector mapping to break a reference cycle. Initial patch
written by Martin Richard.
2015-01-13 09:58:33 +01:00
Victor Stinner fc6fdb112d Issue #23009: Skip test_selectors.test_empty_select() on Windows 2014-12-17 01:07:56 +01:00
Victor Stinner 437ffbdcd8 test_selectors: Tolerate 2.0 seconds instead of 1.6 sec for very slow buildbots 2014-12-12 12:57:35 +01:00
Yury Selivanov d60ef4aa9d selectors: Make sure EpollSelecrtor.select() works when no FD is registered.
Closes issue #23009.
2014-12-08 12:21:58 -05:00
Victor Stinner ee2b237464 Merge 3.4 (test_selectors) 2014-12-12 12:58:45 +01:00
Yury Selivanov 7f98d3ecb8 selectors: Make sure EpollSelecrtor.select() works when no FD is registered.
Closes issue #23009.
2014-12-08 12:22:33 -05:00
Victor Stinner ae58649721 Issue #22043: time.monotonic() is now always available
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
2014-09-02 23:18:25 +02:00
Charles-François Natali 6e20460dc6 Issue #21566: Make use of socket.listen() default backlog. 2014-07-23 19:28:13 +01:00
Charles-François Natali 9d8118e5c5 Issue #21901: Cap the maximum number of file descriptors to use for the test. 2014-07-22 21:29:52 +01:00
Charles-François Natali 889d6463b3 Issue #21901: Cap the maximum number of file descriptors to use for the test. 2014-07-22 21:25:03 +01:00
Giampaolo Rodola' f97e82937f Fix issue 18931: selectors module now supports /dev/poll on Solaris. 2014-03-20 21:43:41 +01:00
Victor Stinner 85310a50a9 Issue #20505: Remove resolution and _granularity from selectors and asyncio
* Remove selectors.BaseSelector.resolution attribute
* Remove asyncio.BaseEventLoop._granularity attribute
2014-02-07 23:34:58 +01:00
Victor Stinner 6b0fa70547 test_selectors: remove unused imports 2014-01-25 15:04:22 +01:00
Victor Stinner 635fca9704 Issue #20311: selectors: Add a resolution attribute to BaseSelector. 2014-01-25 14:56:48 +01:00
Victor Stinner 2041859f27 Issue #20311: Revert e042ea77a152 and 7ce7295393c2, PollSelector.select() and
EpollSelector.select() round again the timeout towards zero
2014-01-25 14:43:45 +01:00
Victor Stinner da94b9ebeb Issue #20311: add debug help in test_selectors 2014-01-23 15:07:26 +01:00
Victor Stinner 11da8e24ba Issue #20311: selector.PollSelector.select() now rounds the timeout away from
zero, instead of rounding towards zero. For example, a timeout of one
microsecond is now rounded to one millisecond, instead of being rounded to
zero.

Move also a test in test_epoll which was moved by my previous merge.
2014-01-21 01:48:28 +01:00
Victor Stinner 383bff4d74 Backed out changeset c4c1c4bc8086 2013-12-09 01:59:07 +01:00
Victor Stinner 1adc2371b8 Issue #19876: Run also test_selectors.test_unregister_after_fd_close_and_reuse() on Windows
os.dup2() is available on Windows.
2013-12-09 01:57:14 +01:00
Charles-François Natali ead8d0858b Fix test_selectors failure introduced by 39e7995f9ad1. 2013-12-08 10:06:04 +01:00
Guido van Rossum 9710ff04ac Silently ignore unregistering closed files. Fixes issue 19876. With docs and slight test refactor. 2013-12-07 15:57:01 -08:00
Victor Stinner 1a048f93bb test_selectors: test_timeout fails sometimes on busy (slow) buildbots, relax
the unit test on max time (but be more strict on mon time). Example of failure:

http://buildbot.python.org/all/builders/x86%20OpenIndiana%203.x/builds/6978/steps/test/logs/stdio

======================================================================
FAIL: test_timeout (test.test_selectors.PollSelectorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/export/home/buildbot/32bits/3.x.cea-indiana-x86/build/Lib/test/test_selectors.py", line 316, in test_timeout
    self.assertTrue(0.5 < t1 - t0 < 1.5, t1 - t0)
AssertionError: False is not true : 1.5033390671014786
2013-11-17 23:46:34 +01:00
Guido van Rossum d0786a1a50 Optimize BaseSelector.modify(). Patch by Arnaud Faure. 2013-11-07 08:39:28 -08:00
Charles-François Natali 4574b49703 Issue #19172: Add a get_map() method to selectors. 2013-10-30 20:31:04 +01:00
Charles-François Natali c60dd5b0d4 test_selectors: make timeout-related errors report the actual elapsed timeout. 2013-10-25 17:56:00 +02:00
Charles-François Natali 052058fa14 test_selectors: rename test_interrupted_retry() (since it doesn't actually
retry on EINTR).
2013-10-25 17:49:47 +02:00
Charles-François Natali 807ba8552a Issue #18963: skip test_selectors.test_above_fd_setsize on older OS X versions. 2013-09-08 12:31:32 +02:00
Charles-François Natali 9437d7a7fe Issue #18963: Fix test_selectors.test_above_fd_setsize on OS X, where the
default RLIMIT_NOFILE hard limit can be RLIMIT_INFINITY.
2013-09-08 11:34:42 +02:00
Charles-François Natali 243d8d85de Issue #16853: Add new selectors module. 2013-09-04 19:02:49 +02:00