Commit Graph

12807 Commits

Author SHA1 Message Date
Jeffrey Yasskin f28896d0bb Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).

Thanks to Trent Nelson for the report and patch.
2008-03-05 06:19:56 +00:00
Neal Norwitz 48309d5a4b Make the timeout longer to give slow machines a chance to pass the test
before timing out.  This doesn't change the duration of the test under
normal circumstances.  This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
2008-03-05 05:38:06 +00:00
Neal Norwitz ce527883dc Catch OSError when trying to remove a file in case removal fails. This
should prevent a failure in tearDown masking any real test failure.
2008-03-05 05:20:44 +00:00
Neal Norwitz 218072595e Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson.  (I can't test this.)
2008-03-05 05:14:18 +00:00
Neal Norwitz 31e88934ed Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson.  Also simplified removing a file by using test_support.
2008-03-05 05:10:48 +00:00
Amaury Forgeot d'Arc d21fb4c2e0 Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::

    >>> f(**g(1=2))
    XXX undetected error
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'int' object is not iterable

instead of the expected SyntaxError: keyword can't be an expression

Will backport.
2008-03-05 01:50:33 +00:00
Fred Drake a28df13a9d fix typo 2008-03-04 21:14:04 +00:00
Neal Norwitz 4a50d26ba2 Close the file before trying to remove the directory so it works on Windows.
As reported by Trent Nelson on python-dev.
2008-03-04 16:22:46 +00:00
Raymond Hettinger d553d856e7 Beef-up docs and tests for itertools. Fix-up end-case for product(). 2008-03-04 04:17:08 +00:00
Raymond Hettinger 10ac19bedc Issue 2226: Callable checked for the wrong abstract method. 2008-03-03 22:19:58 +00:00
Raymond Hettinger 972fb077a0 Remove dependency on itertools -- a simple genexp suffices. 2008-03-03 22:04:55 +00:00
Georg Brandl d2f7680b8f Actually import itertools. 2008-03-03 21:22:47 +00:00
Georg Brandl 26bc177fe6 15 -> 16, the 2nd 2008-03-03 20:39:00 +00:00
Christian Heimes 728bee897f 15 -> 16 2008-03-03 20:30:29 +00:00
Christian Heimes 608c1d8e87 Since abc._Abstract was replaces by a new type flags the regression test suite fails. I've added a new function inspect.isabstract(). Is the mmethod fine or should I check if object is a instance of type or subclass of object, too? 2008-03-03 18:28:04 +00:00
Brett Cannon 7dbd91811d Add test_main() functions to various tests where it was simple to do. Done so
that regrtest can execute the test_main() directly instead of relying on import
side-effects.
2008-03-03 04:19:29 +00:00
Brett Cannon 963c80fd45 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:26:43 +00:00
Brett Cannon bfbf5b3715 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:24:48 +00:00
Brett Cannon 6382ffc892 Move test_largefile over to using 'with' statements for open files.
Also rename the driver function to test_main() instead of main_test().
2008-03-03 02:41:40 +00:00
Brett Cannon 56c4debe0d Refactor test_logging to use unittest. This should finally solve the flakiness
issues.

Thanks to Antoine Pitrou for the patch.
2008-03-03 00:38:58 +00:00
Gregory P. Smith 492e2bfefa Modify import of test_support so that the code can also be used with a
stand alone distribution of bsddb that includes its own small copy of
test_support for the needed functionality on older pythons.
2008-03-02 20:00:53 +00:00
Gerhard Häring f40f6846e3 Made sqlite3 module's regression tests work with SQLite versions that don't
support "create table if not exists", yet.
2008-03-02 13:08:03 +00:00
Barry Warsaw 9d225e63be Give IDLE a release date 2008-03-01 03:00:52 +00:00
Barry Warsaw c853f5d4dc bump idle version number 2008-03-01 02:26:42 +00:00
Gerhard Häring 1cc60ed214 Updated to pysqlite 2.4.1. Documentation additions will come later. 2008-02-29 22:08:41 +00:00
Mark Dickinson f4da77765f Fix docstring typo. 2008-02-29 03:29:17 +00:00
Raymond Hettinger 08ff6822cc Handle the repeat keyword argument for itertools.product(). 2008-02-29 02:21:48 +00:00
Mark Dickinson 1ddf1d8482 Add __format__ method to Decimal, to support PEP 3101 2008-02-29 02:16:37 +00:00
Raymond Hettinger b4cbc98c39 Add alternate constructor for itertools.chain(). 2008-02-28 22:46:41 +00:00
Raymond Hettinger 05bf6338b8 Have itertools.chain() consume its inputs lazily instead of building a tuple of iterators at the outset. 2008-02-28 22:30:42 +00:00
Christian Heimes acfd8ed0cd Windows fix for signal test - skip it earlier 2008-02-28 21:00:45 +00:00
Jeffrey Yasskin 392c159ad6 Prevent SocketServer.ForkingMixIn from waiting on child processes that it
didn't create, in most cases. When there are max_children handlers running, it
will still wait for any child process, not just handler processes.
2008-02-28 18:03:15 +00:00
Andrew M. Kuchling a6298528e1 #2169: make generated HTML more valid 2008-02-28 14:03:03 +00:00
Jeffrey Yasskin 69e1309fd4 Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).

Before:
$  ./python.exe -m timeit -s 'from threading import Thread'  't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$  ./python.exe -m timeit -s 'from threading import Thread; t = Thread()'  't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop

After:
$  ./python.exe -m timeit -s 'from threading import Thread'  't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$  ./python.exe -m timeit -s 'from threading import Thread; t = Thread()'  't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop

To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
2008-02-28 06:09:19 +00:00
Jeffrey Yasskin 180997b2bb Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
2008-02-28 05:53:18 +00:00
Jeffrey Yasskin 960b9b7a2f Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed

  ./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'

up from 2.5us to 0.201us. This fixes issue 1762.
2008-02-28 04:45:36 +00:00
Raymond Hettinger 2ab0552b5e Larger test range 2008-02-27 01:08:30 +00:00
Raymond Hettinger 93e804da9c Add itertools.combinations(). 2008-02-26 23:40:50 +00:00
Christian Heimes ea837931cf Patch #1691070 from Roger Upole: Speed up PyArg_ParseTupleAndKeywords() and improve error msg
My tests don't show the promised speed up of 10%. The code is as fast as the old code for simple cases and slightly faster for complex cases with several of args and kwargs. But the patch simplifies the code, too.
2008-02-26 17:23:51 +00:00
Neal Norwitz ca37661a69 Add a timing flag to Trace so you can see where slowness occurs
like waiting for socket timeouts in test_smtplib :-).
2008-02-26 08:21:28 +00:00
Neal Norwitz 75992edfae Speed up this test by about 99%. Remove sleeps and replace with events.
(This may fail on some slow platforms, but we can fix those cases which
should be relatively isolated and easier to find now.)
Move two test cases that didn't require a server to be started
to a separate TestCase.  These tests were taking 3 seconds which
is what the timeout was set to.
2008-02-26 08:04:59 +00:00
Neal Norwitz b0917c14f2 Don't use a hard coded port. This test could hang/fail if the port is in use.
Speed this test up by avoiding a sleep and using the event.
2008-02-26 04:50:37 +00:00
Raymond Hettinger 39df66179f Revert part of r60927 which made invalid assumptions about the API offered by db modules. 2008-02-25 23:17:41 +00:00
Raymond Hettinger 9d63837e9b Make sure the itertools filter functions give the same performance for func=bool as func=None. 2008-02-25 22:42:32 +00:00
Facundo Batista 4219da4bd0 Issue 2117. Update compiler module to handle class decorators.
Thanks Thomas Herve
2008-02-25 18:06:00 +00:00
Andrew M. Kuchling 734451a4bc Use file descriptor for real stdout 2008-02-25 16:29:58 +00:00
Andrew M. Kuchling aa5e3cea7a Move .setupterm() output so that we don't try to call endwin() if it fails 2008-02-25 16:29:19 +00:00
Brett Cannon c6b5200931 Fix a minor typo in a docstring. 2008-02-25 05:33:33 +00:00
Neal Norwitz 6057b2e645 Create a db_home directory with a unique name so multiple users can
run the test simultaneously.  The simplest thing I found that worked
on both Windows and Unix was to use the PID.  It's unique so should be
sufficient.  This should prevent many of the spurious failures of
the automated tests since they run as different users.

Also cleanup the directory consistenly in the tearDown methods.

It would be nice if someone ensured that the directories are always
created with a consistent name.
2008-02-24 18:47:03 +00:00
Mark Dickinson 6a123cb782 Remove duplicate 'import re' in decimal.py 2008-02-24 18:12:36 +00:00
Facundo Batista c11cecf3d0 Issue 1742669. Now %d accepts very big float numbers.
Thanks Gabriel Genellina.
2008-02-24 03:17:21 +00:00
Georg Brandl 8c460d5241 #1627: httplib now ignores negative Content-Length headers. 2008-02-24 00:14:24 +00:00
Georg Brandl 2363503074 #900744: If an invalid chunked-encoding header is sent by a server,
httplib will now raise IncompleteRead and close the connection instead
of raising ValueError.
2008-02-24 00:03:22 +00:00
Georg Brandl ebcfd11c16 #1506171: added operator.methodcaller(). 2008-02-23 23:04:35 +00:00
Georg Brandl e2065c65d3 #1826: allow dotted attribute paths in operator.attrgetter. 2008-02-23 23:02:23 +00:00
Facundo Batista c12b9888f7 Added simple test case. Thanks Benjamin Peterson. 2008-02-23 22:54:12 +00:00
Georg Brandl 0bb8567e1e In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
2008-02-23 22:35:33 +00:00
Georg Brandl 8d01bb2b19 Use os.closerange() in popen2. 2008-02-23 22:09:24 +00:00
Jeffrey Yasskin a885c1521a Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
2008-02-23 20:40:35 +00:00
Jeffrey Yasskin 3414ea9ed9 Prevent classes like:
class RunSelfFunction(object):
        def __init__(self):
            self.thread = threading.Thread(target=self._run)
            self.thread.start()
        def _run(self):
            pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.

As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
2008-02-23 19:40:54 +00:00
Andrew M. Kuchling 1beea27299 #1389051, #1092502: fix excessively large allocations when using read() on a socket 2008-02-23 19:28:58 +00:00
Andrew M. Kuchling 1219a80989 #1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh. 2008-02-23 19:02:33 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Andrew M. Kuchling 19aff0c90a #1433694: minidom's .normalize() failed to set .nextSibling for last element.
Fix by Malte Helmert
2008-02-23 17:10:46 +00:00
Andrew M. Kuchling 085f75a851 #1330538: Improve comparison of xmlrpclib.DateTime and datetime instances.
Remove automatic handling of datetime.date and datetime.time.
This breaks backward compatibility, but python-dev discussion was strongly
against this automatic conversion; see the bug for a link.
2008-02-23 16:23:05 +00:00
Andrew M. Kuchling 322349e31b #1119331: ncurses will just call exit() if the terminal name isn't found.
Call setupterm() first so that we get a Python exception instead of just existing.
2008-02-23 15:49:35 +00:00
Georg Brandl ad61bc8d9b #2067: file.__exit__() now calls subclasses' close() method. 2008-02-23 15:11:18 +00:00
Facundo Batista 7e251e83d5 Issue 1089358. Adds the siginterrupt() function, that is just a
wrapper around the system call with the same name.  Also added
test cases, doc changes and NEWS entry. Thanks Jason and Ralf
Schmitt.
2008-02-23 15:07:35 +00:00
Georg Brandl 57826cf9f8 #2165: fix test_logging failure on some machines. 2008-02-23 15:06:25 +00:00
Georg Brandl 1647923bbf #1492: allow overriding BaseHTTPServer's content type for error messages. 2008-02-23 15:02:28 +00:00
Christian Heimes 5224d28d38 Patch #1759: Backport of PEP 3129 class decorators
with some help from Georg
2008-02-23 15:01:05 +00:00
Facundo Batista b12f0b581a Issue 1781. Now ConfigParser.add_section does not let you add a
DEFAULT section any more, because it duplicated sections with
the rest of the machinery. Thanks Tim Lesher and Manuel Kaufmann.
2008-02-23 12:46:10 +00:00
Facundo Batista 1660933d23 Issue 1776581. Minor corrections to smtplib, and two small tests.
Thanks Alan McIntyre.
2008-02-23 12:27:17 +00:00
Facundo Batista fc2d01032f Issue 1881. Increased the stack limit from 500 to 1500. Also added
a test for this (and because of this test you'll see in stderr a
message that parser.c sends before raising MemoryError).
Thanks Ralf Schmitt.
2008-02-23 12:01:13 +00:00
Eric Smith a73fbe791d Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct(). 2008-02-23 03:09:44 +00:00
Raymond Hettinger 73d7963242 Improve the implementation of itertools.product()
* Fix-up issues pointed-out by Neal Norwitz.
* Add extensive comments.
* The lz->result variable is now a tuple instead of a list.
* Use fast macro getitem/setitem calls so most code is in-line.
* Re-use the result tuple if available (modify in-place instead of copy).
2008-02-23 02:20:41 +00:00
Eric Smith fb0742fe4f Tests for bin() builtin. These need to get merged into py3k, which has no tests for bin. 2008-02-22 17:43:17 +00:00
Nick Coghlan a14a4e8b84 Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery) 2008-02-22 10:54:06 +00:00
Raymond Hettinger 50986cc45b First draft for itertools.product(). Docs and other updates forthcoming. 2008-02-22 03:16:42 +00:00
Eric Smith ce584d420d Moved test_format into the correct TestCase. 2008-02-21 20:17:08 +00:00
Raymond Hettinger 31ce5cb989 Update more instances of has_key(). 2008-02-21 19:24:53 +00:00
Thomas Heller 8982cf5484 Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
2008-02-21 18:52:20 +00:00
Guido van Rossum 8bc0965adf Removed uses of dict.has_key() from distutils, and uses of
callable() from copy_reg.py, so the interpreter now starts up
without warnings when '-3' is given.  More work like this needs to
be done in the rest of the stdlib.
2008-02-21 18:18:37 +00:00
Andrew M. Kuchling 2d6c13e733 Close manifest file.
This change doesn't make any difference to CPython, but is a necessary fix for Jython.
2008-02-21 14:23:38 +00:00
Eric Smith 7ef40bf9c7 Trim leading zeros from a floating point exponent, per C99. See issue 1600. As far as I know, this only affects Windows. Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description). 2008-02-20 23:34:22 +00:00
Eric Smith bc32fee029 Added code to correct combining str and unicode in ''.format(). Added test case. 2008-02-18 18:02:34 +00:00
Eric Smith d50a5f2845 Temporarily removed float tests. See issue 1600. 2008-02-18 14:25:02 +00:00
Facundo Batista d14600ec94 Issue 1224. Now we support again the double slash in the URL.
Thanks Anthony Lenton.
2008-02-18 12:48:43 +00:00
Facundo Batista 759bfc6207 Issue #1916. Added isgenerator() and isgeneratorfunction() to
inspect.py.  Thanks Javi Mansilla for patch review and
corrections.
2008-02-18 03:43:43 +00:00
Georg Brandl b169eaa917 #2133: fix HTML color spec. 2008-02-17 21:18:55 +00:00
Eric Smith a9f7d62480 Backport of PEP 3101, Advanced String Formatting, from py3k.
Highlights:
 - Adding PyObject_Format.
 - Adding string.Format class.
 - Adding __format__ for str, unicode, int, long, float, datetime.
 - Adding builtin format.
 - Adding ''.format and u''.format.
 - str/unicode fixups for formatters.

The files in Objects/stringlib that implement PEP 3101 (stringdefs.h,
unicodedefs.h, formatter.h, string_format.h) are identical in trunk
and py3k.  Any changes from here on should be made to trunk, and
changes will propogate to py3k).
2008-02-17 19:46:49 +00:00
Facundo Batista e139688d34 Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
2008-02-17 18:59:29 +00:00
Brett Cannon f9db8a3a20 Move test_logging over to doctest.
Thanks to Christopher White from GHOP.
2008-02-17 01:59:18 +00:00
Amaury Forgeot d'Arc 632fad3933 Prevent a crash with nested scopes, again caused by calling Py_DECREF when the pointer
is still present in the containing structure.
2008-02-16 20:55:24 +00:00
Raymond Hettinger 71fa93af22 Add __all__ to logging module. 2008-02-16 01:22:54 +00:00
Amaury Forgeot d'Arc 64d6843788 mmap.PROT_READ does not exists on win32;
Skip this test created by r60830.
2008-02-16 00:16:50 +00:00
Amaury Forgeot d'Arc d8bcbf2b2e Re-enable tests, they were failing since gc.collect() clears the various freelists.
They still remain fragile.

For example, a call to assertEqual currently does not make any allocation
(which surprised me at first).
But this can change when gc.collect also deletes the numerous "zombie frames"
attached to each function.
2008-02-15 22:44:20 +00:00
Kurt B. Kaiser f05fa33a6c Configured selection highlighting colors were ignored; updating highlighting
in the config dialog would cause non-Python files to be colored as if they
were Python source; improve use of ColorDelagator.  Patch 1334. Tal Einat.
2008-02-15 22:25:09 +00:00
Kurt B. Kaiser e312cfddd3 ScriptBinding event handlers weren't returning 'break'. Patch 2050, Tal Einat. 2008-02-15 21:56:36 +00:00
Amaury Forgeot d'Arc f67abccf64 Temporarily let these tests pass 2008-02-15 21:27:44 +00:00