Commit Graph

34 Commits

Author SHA1 Message Date
Victor Stinner 5b23f7618d
bpo-39239: epoll.unregister() no longer ignores EBADF (GH-17882)
The select.epoll.unregister() method no longer ignores the EBADF
error.
2020-01-07 15:00:02 +01:00
Giampaolo Rodola eb7e29f2a9
bpo-35934: Add socket.create_server() utility function (GH-11784) 2019-04-09 00:34:02 +02:00
Serhiy Storchaka 5b10b98247
bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929) 2019-03-05 10:06:26 +02:00
Tal Einat 0cdf5f4289
bpo-32568: make select.epoll() and its docs consistent (#7840)
* `flags` is indeed deprecated, but there is a validation on its value for
  backwards compatibility reasons.  This adds mention of this in the docs.
* The docs say that `sizehint` is deprecated and ignored, but it is still
  used when `epoll_create1()` is unavailable. This adds mention of this in
  the docs.
* `sizehint=-1` is acceptable again, and is replaced with `FD_SETSIZE-1`.
  This is needed to have a default value available at the Python level,
  since `FD_SETSIZE` is not exposed to Python. (see: bpo-31938)
* Reject `sizehint=0` since it is invalid to pass on to `epoll_create()`.

The relevant tests have also been updated.
2018-06-30 15:43:23 +03:00
Berker Peksag e2197d1312 Issue #20100: Simplify newPyEpoll_Object()
EPOLL_CLOEXEC is the only value that can be passed
to epoll_create1() and we are passing EPOLL_CLOEXEC
unconditionally since Python 3.4.
2016-09-26 23:30:41 +03:00
Serhiy Storchaka e4fbb0206d Remove unused support.run_unittest imports.
It is not needed since tests use unittest.main().
2016-04-24 23:42:49 +03:00
Zachary Ware 38c707e7e0 Issue #21741: Update 147 test modules to use test discovery.
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux.  The only differences I found were actually tests
that were previously *not* run.
2015-04-13 15:00:43 -05: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 b60ac7acfb Issue #21038: Use monotonic clock to compute timeout, not the system clock 2014-03-25 12:50:50 +01:00
Victor Stinner 6f20b7c473 Issue #21038: Cleanup test_epoll.py
Remove useless test and unused variables. Initial patch by Andreas Schwab.
2014-03-25 12:49:53 +01:00
Victor Stinner 38c72bd199 (Merge 3.3) Issue #20311: Revert 033137c12d88 (02f9db3e684e),
select.epoll.poll() rounds again the timeout towards zero
2014-01-25 14:40:04 +01:00
Victor Stinner 933209689e Issue #20311: Revert 033137c12d88, select.epoll.poll() rounds again the timeout
towards zero
2014-01-25 14:37:50 +01:00
Victor Stinner 240cae7d17 (Merge 3.3) Issue #20311: Try to fix the unit test, use time.monotonic()
instead of time.perf_counter()
2014-01-21 02:38:33 +01:00
Victor Stinner 39d798eb03 Issue #20311: Try to fix the unit test, use time.monotonic() instead of
time.perf_counter()

Move also the unit test at the end.
2014-01-21 02:37:41 +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 09354fd606 (Merge 3.3) Issue #20311: select.epoll.poll() 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.
2014-01-21 01:42:11 +01:00
Victor Stinner 665486e0e7 Issue #20311: select.epoll.poll() 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.
2014-01-21 01:41:00 +01: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
Victor Stinner 13423c3726 Close #18794: Add a fileno() method and a closed attribute to select.devpoll
objects.

Add also tests on fileno() method and closed attribute of select.epoll and select.kqueue.
2013-08-22 00:19:50 +02:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov 0832af6628 Issue #16717: get rid of socket.error, replace with OSError 2012-12-18 23:10:48 +02:00
Antoine Pitrou 09bb89b8cf Issue #16488: epoll() objects now support the `with` statement.
Patch by Serhiy Storchaka.
2012-12-15 21:14:21 +01:00
Benjamin Peterson 70069fcd4b don't fail if CLOEXEC doesn't exist 2011-12-27 16:52:20 -06:00
Benjamin Peterson a5f6f2aba3 merge 3.2 2011-12-27 15:17:15 -06:00
Benjamin Peterson 0e61350d3a propgate error in other conditions 2011-12-27 15:16:34 -06:00
Benjamin Peterson 2fb9ae9dfc add a flags parameter to select.epoll 2011-12-27 15:15:41 -06:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Georg Brandl 1b37e8728c Merged revisions 78093 via svnmerge from
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.
........
2010-03-14 10:45:50 +00:00
Benjamin Peterson c9c0f201fe convert old fail* assertions to assert* 2009-06-30 23:06:06 +00:00
R. David Murray 1855c214d7 Merged revisions 73077 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73077 | r.david.murray | 2009-05-31 15:15:57 -0400 (Sun, 31 May 2009) | 4 lines

  Issue 3848: document the fact that epoll register raises an IOError if
  an fd is registered twice, and add some additional epoll tests.  Patch
  by Christian Heimes.
........
2009-05-31 19:44:27 +00:00
Benjamin Peterson e549ead826 Merged revisions 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
........
2009-03-28 21:42:05 +00:00
Benjamin Peterson ee8712cda4 #2621 rename test.test_support to test.support 2008-05-20 21:35:26 +00:00
Christian Heimes fe337bfd0d Merged revisions 61724-61725,61731-61735,61737,61739,61741,61743-61744,61753,61761,61765-61767,61769,61773,61776-61778,61780-61783,61788,61793,61796,61807,61813 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

................
  r61724 | martin.v.loewis | 2008-03-22 01:01:12 +0100 (Sat, 22 Mar 2008) | 49 lines

  Merged revisions 61602-61723 via svnmerge from
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

  ........
    r61626 | david.wolever | 2008-03-19 17:19:16 +0100 (Mi, 19 M?\195?\164r 2008) | 1 line

    Added fixer for implicit local imports.  See #2414.
  ........
    r61628 | david.wolever | 2008-03-19 17:57:43 +0100 (Mi, 19 M?\195?\164r 2008) | 1 line

    Added a class for tests which should not run if a particular import is found.
  ........
    r61629 | collin.winter | 2008-03-19 17:58:19 +0100 (Mi, 19 M?\195?\164r 2008) | 1 line

    Two more relative import fixes in pgen2.
  ........
    r61635 | david.wolever | 2008-03-19 20:16:03 +0100 (Mi, 19 M?\195?\164r 2008) | 1 line

    Fixed print fixer so it will do the Right Thing when it encounters __future__.print_function.  2to3 gets upset, though, so the tests have been commented out.
  ........
    r61637 | david.wolever | 2008-03-19 21:37:17 +0100 (Mi, 19 M?\195?\164r 2008) | 3 lines

    Added a fixer for itertools imports (from itertools import imap, ifilterfalse --> from itertools import filterfalse)
  ........
    r61645 | david.wolever | 2008-03-19 23:22:35 +0100 (Mi, 19 M?\195?\164r 2008) | 1 line

    SVN is happier when you add the files you create... -_-'
  ........
    r61654 | david.wolever | 2008-03-20 01:09:56 +0100 (Do, 20 M?\195?\164r 2008) | 1 line

    Added an explicit sort order to fixers -- fixes problems like #2427
  ........
    r61664 | david.wolever | 2008-03-20 04:32:40 +0100 (Do, 20 M?\195?\164r 2008) | 3 lines

    Fixes #2428 -- comments are no longer eatten by __future__ fixer.
  ........
    r61673 | david.wolever | 2008-03-20 17:22:40 +0100 (Do, 20 M?\195?\164r 2008) | 1 line

    Added 2to3 node pretty-printer
  ........
    r61679 | david.wolever | 2008-03-20 20:50:42 +0100 (Do, 20 M?\195?\164r 2008) | 1 line

    Made node printing a little bit prettier
  ........
    r61723 | martin.v.loewis | 2008-03-22 00:59:27 +0100 (Sa, 22 M?\195?\164r 2008) | 2 lines

    Fix whitespace.
  ........
................
  r61725 | martin.v.loewis | 2008-03-22 01:02:41 +0100 (Sat, 22 Mar 2008) | 2 lines

  Install lib2to3.
................
  r61731 | facundo.batista | 2008-03-22 03:45:37 +0100 (Sat, 22 Mar 2008) | 4 lines


  Small fix that complicated the test actually when that
  test failed.
................
  r61732 | alexandre.vassalotti | 2008-03-22 05:08:44 +0100 (Sat, 22 Mar 2008) | 2 lines

  Added warning for the removal of 'hotshot' in Py3k.
................
  r61733 | georg.brandl | 2008-03-22 11:07:29 +0100 (Sat, 22 Mar 2008) | 4 lines

  #1918: document that weak references *to* an object are
  cleared before the object's __del__ is called, to ensure that the weak
  reference callback (if any) finds the object healthy.
................
  r61734 | georg.brandl | 2008-03-22 11:56:23 +0100 (Sat, 22 Mar 2008) | 2 lines

  Activate the Sphinx doctest extension and convert howto/functional to use it.
................
  r61735 | georg.brandl | 2008-03-22 11:58:38 +0100 (Sat, 22 Mar 2008) | 2 lines

  Allow giving source names on the cmdline.
................
  r61737 | georg.brandl | 2008-03-22 12:00:48 +0100 (Sat, 22 Mar 2008) | 2 lines

  Fixup this HOWTO's doctest blocks so that they can be run with sphinx' doctest builder.
................
  r61739 | georg.brandl | 2008-03-22 12:47:10 +0100 (Sat, 22 Mar 2008) | 2 lines

  Test decimal.rst doctests as far as possible with sphinx doctest.
................
  r61741 | georg.brandl | 2008-03-22 13:04:26 +0100 (Sat, 22 Mar 2008) | 2 lines

  Make doctests in re docs usable with sphinx' doctest.
................
  r61743 | georg.brandl | 2008-03-22 13:59:37 +0100 (Sat, 22 Mar 2008) | 2 lines

  Make more doctests in pprint docs testable.
................
  r61744 | georg.brandl | 2008-03-22 14:07:06 +0100 (Sat, 22 Mar 2008) | 2 lines

  No need to specify explicit "doctest_block" anymore.
................
  r61753 | georg.brandl | 2008-03-22 21:08:43 +0100 (Sat, 22 Mar 2008) | 2 lines

  Fix-up syntax problems.
................
  r61761 | georg.brandl | 2008-03-22 22:06:20 +0100 (Sat, 22 Mar 2008) | 4 lines

  Make collections' doctests executable.

  (The <BLANKLINE>s will be stripped from presentation output.)
................
  r61765 | georg.brandl | 2008-03-22 22:21:57 +0100 (Sat, 22 Mar 2008) | 2 lines

  Test doctests in datetime docs.
................
  r61766 | georg.brandl | 2008-03-22 22:26:44 +0100 (Sat, 22 Mar 2008) | 2 lines

  Test doctests in operator docs.
................
  r61767 | georg.brandl | 2008-03-22 22:38:33 +0100 (Sat, 22 Mar 2008) | 2 lines

  Enable doctests in functions.rst.  Already found two errors :)
................
  r61769 | georg.brandl | 2008-03-22 23:04:10 +0100 (Sat, 22 Mar 2008) | 3 lines

  Enable doctest running for several other documents.
  We have now over 640 doctests that are run with "make doctest".
................
  r61773 | raymond.hettinger | 2008-03-23 01:55:46 +0100 (Sun, 23 Mar 2008) | 1 line

  Simplify demo code.
................
  r61776 | neal.norwitz | 2008-03-23 04:43:33 +0100 (Sun, 23 Mar 2008) | 7 lines

  Try to make this test a little more robust and not fail with:
    timeout (10.0025) is more than 2 seconds more than expected (0.001)

  I'm assuming this problem is caused by DNS lookup.  This change
  does a DNS lookup of the hostname before trying to connect, so the time
  is not included.
................
  r61777 | neal.norwitz | 2008-03-23 05:08:30 +0100 (Sun, 23 Mar 2008) | 1 line

  Speed up the test by avoiding socket timeouts.
................
  r61778 | neal.norwitz | 2008-03-23 05:43:09 +0100 (Sun, 23 Mar 2008) | 1 line

  Skip the epoll test if epoll() does not work
................
  r61780 | neal.norwitz | 2008-03-23 06:47:20 +0100 (Sun, 23 Mar 2008) | 1 line

  Suppress failure (to avoid a flaky test) if we cannot connect to svn.python.org
................
  r61781 | neal.norwitz | 2008-03-23 07:13:25 +0100 (Sun, 23 Mar 2008) | 4 lines

  Move itertools before future_builtins since the latter depends on the former.
  From a clean build importing future_builtins would fail since itertools
  wasn't built yet.
................
  r61782 | neal.norwitz | 2008-03-23 07:16:04 +0100 (Sun, 23 Mar 2008) | 1 line

  Try to prevent the alarm going off early in tearDown
................
  r61783 | neal.norwitz | 2008-03-23 07:19:57 +0100 (Sun, 23 Mar 2008) | 4 lines

  Remove compiler warnings (on Alpha at least) about using chars as
  array subscripts.  Using chars are dangerous b/c they are signed
  on some platforms and unsigned on others.
................
  r61788 | georg.brandl | 2008-03-23 09:05:30 +0100 (Sun, 23 Mar 2008) | 2 lines

  Make the doctests presentation-friendlier.
................
  r61793 | amaury.forgeotdarc | 2008-03-23 10:55:29 +0100 (Sun, 23 Mar 2008) | 4 lines

  #1477: ur'\U0010FFFF' raised in narrow unicode builds.
  Corrected the raw-unicode-escape codec to use UTF-16 surrogates in
  this case, just like the unicode-escape codec.
................
  r61796 | raymond.hettinger | 2008-03-23 14:32:32 +0100 (Sun, 23 Mar 2008) | 1 line

  Issue 1681432:  Add triangular distribution the random module.
................
  r61807 | raymond.hettinger | 2008-03-23 20:37:53 +0100 (Sun, 23 Mar 2008) | 4 lines

  Adopt Nick's suggestion for useful default arguments.
  Clean-up floating point issues by adding true division and float constants.
................
  r61813 | gregory.p.smith | 2008-03-23 22:04:43 +0100 (Sun, 23 Mar 2008) | 6 lines

  Fix gzip to deal with CRC's being signed values in Python 2.x properly and to
  read 32bit values as unsigned to start with rather than applying signedness
  fixups allover the place afterwards.

  This hopefully fixes the test_tarfile failure on the alpha/tru64 buildbot.
................
2008-03-23 21:54:12 +00:00
Christian Heimes 4fbc72b4ac Merged revisions 61687-61688,61696,61700,61704-61705,61707-61709,61711-61712,61714-61716,61718-61722 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r61687 | jeffrey.yasskin | 2008-03-21 06:02:44 +0100 (Fri, 21 Mar 2008) | 2 lines

  Speed up test_signal from ~24s to 4s by avoiding nearly all of the sleep calls.
........
  r61688 | jeffrey.yasskin | 2008-03-21 06:51:37 +0100 (Fri, 21 Mar 2008) | 5 lines

  Try to fix test_signal breakages on Linux due to r61687. It appears that at
  least two of the linux build bots aren't leaving zombie processes around for
  os.waitpid to wait for, causing ECHILD errors. This would be a symptom of a bug
  somewhere, but probably not in signal itself.
........
  r61696 | georg.brandl | 2008-03-21 15:32:33 +0100 (Fri, 21 Mar 2008) | 2 lines

  Mark the descitems in the tutorial as "noindex" so that :meth: cross-refs don't link to them.
........
  r61700 | georg.brandl | 2008-03-21 18:19:29 +0100 (Fri, 21 Mar 2008) | 2 lines

  Fix markup.
........
  r61704 | jeffrey.yasskin | 2008-03-21 19:25:06 +0100 (Fri, 21 Mar 2008) | 3 lines

  Try to fix test_signal on FreeBSD. I'm assuming that os.kill is failing to
  raise a signal, but switching to subprocess makes the code cleaner anyway.
........
  r61705 | jeffrey.yasskin | 2008-03-21 19:48:04 +0100 (Fri, 21 Mar 2008) | 7 lines

  Speed test_threading up from 14s to .5s, and avoid a deadlock on certain
  failures. The test for enumerate-after-join is now a little less rigorous, but
  the bug it references says the error happened in the first couple iterations,
  so 100 iterations should still be enough.

  cProfile was useful for identifying the slow tests here.
........
  r61707 | georg.brandl | 2008-03-21 20:14:38 +0100 (Fri, 21 Mar 2008) | 2 lines

  Fix a code block in __future__ docs.
........
  r61708 | georg.brandl | 2008-03-21 20:20:21 +0100 (Fri, 21 Mar 2008) | 2 lines

  Add docs for __func__ and __self__ on methods.
........
  r61709 | georg.brandl | 2008-03-21 20:37:57 +0100 (Fri, 21 Mar 2008) | 2 lines

  Add docs for print_function and future_builtins. Fixes #2442.
........
  r61711 | georg.brandl | 2008-03-21 20:54:00 +0100 (Fri, 21 Mar 2008) | 2 lines

  #2136: allow single quotes in realm spec.
........
  r61712 | georg.brandl | 2008-03-21 21:01:51 +0100 (Fri, 21 Mar 2008) | 3 lines

  Issue #2432: give DictReader the dialect and line_num attributes
  advertised in the docs.
........
  r61714 | georg.brandl | 2008-03-21 21:11:46 +0100 (Fri, 21 Mar 2008) | 2 lines

  #2358: add py3k warning to sys.exc_clear().
........
  r61715 | georg.brandl | 2008-03-21 21:21:46 +0100 (Fri, 21 Mar 2008) | 2 lines

  #2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich.
........
  r61716 | georg.brandl | 2008-03-21 21:38:24 +0100 (Fri, 21 Mar 2008) | 2 lines

  #2348: add py3k warning for file.softspace.
........
  r61718 | georg.brandl | 2008-03-21 21:55:20 +0100 (Fri, 21 Mar 2008) | 2 lines

  #2160: document PyImport_GetImporter.
........
  r61719 | georg.brandl | 2008-03-21 21:55:51 +0100 (Fri, 21 Mar 2008) | 2 lines

  Update doc ACKS.
........
  r61720 | steven.bethard | 2008-03-21 22:01:18 +0100 (Fri, 21 Mar 2008) | 1 line

  Replace hack in regrtest.py with use of sys.py3kwarning.
........
  r61721 | georg.brandl | 2008-03-21 22:05:03 +0100 (Fri, 21 Mar 2008) | 2 lines

  Add missing versionadded tag.
........
  r61722 | christian.heimes | 2008-03-22 00:49:44 +0100 (Sat, 22 Mar 2008) | 3 lines

  Applied patch #1657 epoll and kqueue wrappers for the select module
  The patch adds wrappers for the Linux epoll syscalls and the BSD kqueue syscalls. Thanks to Thomas Herve and the Twisted people for their support and help.
  TODO: Finish documentation documentation
........
2008-03-22 00:47:35 +00:00