Commit Graph

385 Commits

Author SHA1 Message Date
Jason Erickson
8746b0c6b7 Skip test_cleanup_on_badconn_close on Windows
The Windows server version of PostgreSQL uses a function called pgkill in the
file kill.c in place of the UNIX kill function.  This pgkill function
simulates some of the SIGHUP like commands by passing signals through a named
pipe.  Because it is passing the signal through a pipe, the server doesn't get
the kill signal immediately and therefore fails the test on
test_connection.ConnectionTests.test_cleanup_on_badconn_close.
Ideally, the test should check to see if the server is running on Windows, not
the psycopg.
2014-05-19 12:15:53 +01:00
Jason Erickson
c5f2e29dde Added select.select timeout on AsyncTests.wait
On Windows, the select.select() hangs/waits forever on the
test_async_connection_error_message() test.  Adding a 10 second timeout
allows the tests to continue.
2014-05-19 12:15:52 +01:00
Daniele Varrazzo
35545e7374 Skip rowcount on copy test on postgres < 8.2
It looks like the server doesn't send the message.
2014-05-13 14:34:09 +01:00
Daniele Varrazzo
81b5f1fb26 Copy operations correctly set the cursor.rowcount attribute
Fixes ticket #180.
2014-05-05 23:53:50 +01:00
Daniele Varrazzo
69605e54ec Fixed explicit connection.cursor(cursor_factory=None)
Fixes issue #210.
2014-04-30 17:57:55 +01:00
Daniele Varrazzo
1654687d1b Check the connection is really bad on exception before closing it
We end up here without a pgres sometimes (e.g. from lobject errors)
2014-04-05 16:03:06 +01:00
Daniele Varrazzo
a8fdc74090 Fixed overflow opening a lobject with an oid not fitting in a signed int
Fixes 🎫`203`.
2014-04-03 02:35:56 +01:00
Daniele Varrazzo
dfacc483b5 Dropped unneeded pass in test 2014-04-03 02:32:05 +01:00
Daniele Varrazzo
e7fc7f31b9 Fixed dsn and closed attributes in failing connection subclasses.
From ticket #192 discussion.
2014-04-03 01:42:35 +01:00
Daniele Varrazzo
7b82be936d Don't segfault on uninitialized cursor
It can happen with bad cursor subclasses not calling super's init. Raise
an exception instead of segfaulting.

Closes #195
2014-02-26 19:41:59 +00:00
Daniele Varrazzo
283dbccf56 Merge branch 'range_sort' 2014-02-22 23:02:19 +00:00
Daniele Varrazzo
6192a4fb17 Added str() for the Json adapter
Fixes ticket #191.
2014-02-22 20:45:35 +00:00
Chris Withers
e60266c4c5 New implementation of Range sorting that works for Python 2.5 to 3.3, at least. 2014-02-18 20:55:00 +00:00
Chris Withers
bae508ffa6 Coding style changes. 2014-02-14 07:46:32 +00:00
Chris Withers
d469c32503 Provide a stable and consistent sort order for Range objects.
This matches postgres server-side behaviour and helps client applications that need to sort based on the primary key of tables where the primary key is or contains a range.
2014-02-12 08:11:59 +00:00
Daniele Varrazzo
e11d0d39ec Check connection type in lobject init
Fixes ticket #187.
2013-11-27 12:44:28 +00:00
Daniele Varrazzo
2e3833f7fb Really test named cursors in test_scroll_named() 2013-10-16 19:10:21 +01:00
Daniele Varrazzo
1e623a951c Meaningful connection errors report a meaningful message
Fixes issue #173.
2013-10-16 17:50:10 +01:00
Daniele Varrazzo
345077d5f7 Fixed pickling of exceptions with no pgerror/pgcode set
Fixes ticket #170.
2013-07-19 16:05:59 +01:00
Daniele Varrazzo
ea08f7e7c7 Merge branch 'range_eq_typerror' 2013-06-18 14:14:01 +01:00
Daniele Varrazzo
d50ea3d82b Uniform Range eq tests style 2013-06-18 14:10:49 +01:00
Chris Withers
28276e3eb1 cater for comparison of subclasses 2013-05-26 22:20:07 +01:00
Chris Withers
b6a9e0ffaf raising an exception here rather than returning False causes problems with SQLAlchemy's internal state tracking 2013-05-26 21:58:39 +01:00
Chris Withers
8bb44f3444 more useful error message when comparing ranges with non-ranges 2013-05-26 21:20:40 +01:00
Daniele Varrazzo
1ef234ebfc Added regression test for infinity parsing in dates
...and a couple of typos.
2013-05-11 02:19:59 +01:00
Daniele Varrazzo
c796bc2cbd Added test to verify copysize handling in copy_expert
Not an original psycopg2 bug but present in pure python implementation,
e.g. ctypes issue #25 and cffi issue #5.

https://github.com/mvantellingen/psycopg2-ctypes/issues/25
https://github.com/chtd/psycopg2cffi/pull/5
2013-05-06 10:48:10 +01:00
Daniele Varrazzo
a44db81d9b Skip tests on python implementations without getrefcount()
PyPy is one of these.
2013-05-06 10:39:24 +01:00
Piotr Kasprzyk
31b6ec63f8 Fix multiple misspellings 2013-04-26 09:59:40 +01:00
Daniele Varrazzo
5d86d07618 Testing external script independent from psycopg implementation
Patch needed to run the test suite on psycopg2cffi or psycopg2ct.
2013-04-19 23:01:28 +01:00
Daniele Varrazzo
9e15f54fe8 Added cursor_factory connection attribute and connect() parameter 2013-04-07 02:30:12 +01:00
Daniele Varrazzo
0e06addc9f Testing boilerplate unified in a single base class
The class makes a connection always available, allows creating
new connection and closes everything on tear down.
2013-04-07 00:23:30 +01:00
Daniele Varrazzo
c63d623f65 Merge branch 'drop-py24' into devel 2013-04-05 01:29:25 +01:00
Daniele Varrazzo
736a78f3f6 Avoid encoding strdup in qstring adapter
Dropped encoding parameter in the constructor: it is used
nowhere and not documented. Use directly the connection
encoding if available, else the previous latin1 fallback.
2013-04-05 00:00:42 +01:00
Daniele Varrazzo
546927d44a Use wrap to fix names of decorated test methods
Decorators not using wrap() prevent running the test from command line, e.g.
with:

    python tests/__init__.py test_module.TestSuite.test_method
2013-03-20 23:53:20 +00:00
Daniele Varrazzo
31265e3439 Fixed broken test decorator preventing 3 tests to run 2013-03-20 23:53:19 +00:00
Daniele Varrazzo
b6873ee1ab Dropped support for Python 2.4 2013-03-20 23:40:13 +00:00
Daniele Varrazzo
09629a6dbc Use wrap to fix names of decorated test methods
Decorators not using wrap() prevent running the test from command line, e.g.
with:

    python tests/__init__.py test_module.TestSuite.test_method
2013-03-20 17:26:10 +00:00
Daniele Varrazzo
0c0e2a2455 Fixed broken test decorator preventing 3 tests to run 2013-03-20 17:13:33 +00:00
Daniele Varrazzo
73949cd1b8 Merge branch 'diagnostics' into devel 2013-03-20 01:47:14 +00:00
Daniele Varrazzo
114c62fac8 Added tests to verify the new Diagnostics properties
diag can be used on exceptions raised without cursor and is independent from
the cursor.

Docs updated to reflect the changes.
2013-03-20 00:03:58 +00:00
Daniele Varrazzo
294e7ae080 Tests tweaked to run on all the supported versions 2013-03-18 10:06:07 +00:00
Daniele Varrazzo
97311967e8 Merge branch 'diagnostics' into devel 2013-03-18 02:21:09 +00:00
Daniele Varrazzo
70b756b8c7 Added test to verify Diagnostics works after copy errors 2013-03-18 00:31:25 +00:00
Daniele Varrazzo
660386929f Added test to verify Diagnostics reference disposal 2013-03-18 00:24:46 +00:00
Daniele Varrazzo
42b063b562 Added all supported properties to the Diagnostic object 2013-03-17 23:58:10 +00:00
Matthew Woodcraft
c75a3bbab4 Work-in-progress support for retrieving PG_DIAG result error fields. 2013-03-17 16:41:15 +00:00
Daniele Varrazzo
af18c29f0b Fixed exception handling in disconnection test
OperationalError is DatabaseError's subclass.
2013-03-16 21:43:11 +00:00
Daniele Varrazzo
c5de7b5ac6 Fixed Decimal range tests 2013-03-16 17:58:58 +00:00
Daniele Varrazzo
594a4d79ec Fixed handling of database disconnection in tests in green mode 2013-03-16 17:41:59 +00:00
Daniele Varrazzo
66d6c68dcc Properly cleanup memory of broken connections
Fixed ticket #148.
2013-03-16 11:56:38 +00:00