Commit Graph

234 Commits

Author SHA1 Message Date
Daniele Varrazzo
8a1de1ec4e Added test to verify named cursor efficiency.
Iter shouldn't fetch one record at time.
2011-02-01 03:01:47 +00:00
Daniele Varrazzo
bde443a902 Fixed standard_conforming_strings filtering in Python 3 tests 2011-01-18 02:45:31 +00:00
Daniele Varrazzo
9f90f049ab Merge branch 'python2' into python3
Conflicts:
	tests/bug_gc.py
	tests/types_extras.py
2011-01-18 02:11:58 +00:00
Daniele Varrazzo
153c30f24b Skip composite type tests if the server doesn't support them 2011-01-18 02:09:49 +00:00
Daniele Varrazzo
ca3d9da83b Skip GC bug test if uuid is not available 2011-01-18 02:09:49 +00:00
Daniele Varrazzo
06059a216f Fixed hstore test in PG 9.x with standard_conforming_strings off 2011-01-18 00:58:33 +00:00
Daniele Varrazzo
8e1257d7d0 Fixed check for pg_sleep availability in tests
The function is available since PG 8.2.
2011-01-18 00:57:27 +00:00
Daniele Varrazzo
3ba0631dbb A few large objects tests fixed
The behavior changed in Python 3 after the lobject-decode merge.
2011-01-10 22:05:47 +00:00
Daniele Varrazzo
ba1d77a297 Large object mode parsing refactored
Added parsing of text/binary mode.
2011-01-10 00:46:51 +00:00
Daniele Varrazzo
f63167a92c Added tests to check large objects decoding 2011-01-10 00:46:51 +00:00
Daniele Varrazzo
79048ff19a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	tests/__init__.py
	tests/test_lobject.py
	tests/test_quote.py
	tests/testutils.py
2011-01-10 00:46:02 +00:00
Daniele Varrazzo
48588e5f69 Invalidate large objects after a two-phase commit operation 2011-01-10 00:20:55 +00:00
Daniele Varrazzo
935c25730a Fixed segfault in large object close.
Check that the connection is not closed/faulty before attempting lo_close.
2011-01-10 00:11:14 +00:00
Daniele Varrazzo
38641b93ea Test decorator moved into the test utilities module 2011-01-09 23:44:58 +00:00
Daniele Varrazzo
15a09da96d Added license to unit tests
As the test suite is now part of the source distribution.
2011-01-09 23:44:35 +00:00
Daniele Varrazzo
f8c4335f35 Avoid ResourceWarning in tests in Python 3.2 2011-01-08 23:54:48 +00:00
Daniele Varrazzo
43c8fce45c Silence warnings due to deprecated TestCase methods
With a veiled criticism.
2011-01-08 23:54:17 +00:00
Daniele Varrazzo
7c1b03bd45 All tests made executable. 2011-01-07 00:58:29 +00:00
Daniele Varrazzo
80bd6e2794 Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	psycopg/connection_type.c
	tests/test_connection.py
	tests/types_basic.py
2011-01-03 21:43:02 +01:00
Daniele Varrazzo
5f6e773575 Broken circular reference in async execution
If a connection is destroyed before an async operation is completed, the
`async_cursor` member creates a reference loop, leaving the connection and
the cursor alive. `async_cursor` is now a weak reference.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
19ff51ae75 The cursor is weakly referenceable 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
04cf90cc21 The connection is weakly referenceable 2011-01-03 21:34:49 +01:00
Daniele Varrazzo
8b0af283f6 Don't register the unicode typecaster globally during tests
It can invalidate the results in further runs in the same process.
2011-01-03 21:34:49 +01:00
Daniele Varrazzo
131c6a25e9 Unregister test adapters to keep a more precise references count 2011-01-03 21:34:46 +01:00
Daniele Varrazzo
a01700d478 Fixed test suite execution as a script
Don't know why I changed the defaultTest argument into a function when I
converted the test suite into a package: that argument should be really
a string.
2011-01-03 20:45:03 +01:00
Daniele Varrazzo
929d62053a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	setup.py
2011-01-02 03:28:00 +01:00
Daniele Varrazzo
3cc8719998 Added missing test to the test suite. 2011-01-02 03:00:44 +01:00
Daniele Varrazzo
88bb8eda3e None/IN adaptation ported to Python 3. 2011-01-02 00:44:14 +01:00
Daniele Varrazzo
7ac0bdd661 Added PostgreSQL composite types typecaster to Python tuples. 2011-01-02 00:34:13 +01:00
Daniele Varrazzo
159cda3688 Added cursor.cast() method
The method exposes the typecasters lookup algorithm. Useful to create
recursive typecasters.
2011-01-01 22:55:10 +01:00
Daniele Varrazzo
3e94375cf7 Merge branch 'python2' into python3
Conflicts:
	ChangeLog
	NEWS-2.3
	lib/extensions.py
	psycopg/microprotocols.c
	setup.py
2011-01-01 17:14:54 +01:00
Daniele Varrazzo
fdfa2de1a1 Fixed adaptation of None in composite types (ticket #26).
Added an adapter for None: it is usually not invoked as adaptation to
NULL is a fast path in mogrify, but can be invoked by composite types.
Notice that composite types still have the option to fast-path None
(e.g. list adapter does).
2011-01-01 17:07:54 +01:00
Daniele Varrazzo
b5a8facb9c Added test to show failed adaptation of None in records. 2010-12-31 18:54:50 +01:00
Daniele Varrazzo
0a4eeb4e13 Fixed notification tests to run on Py3.
Call 2to3 on the dynamically generated scripts.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
b78ff4a273 Several tests ported to Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
2fa9117835 Inet adapter compatible with Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
c176de4bf8 Hstore adapter compatible with Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
ab5934dc35 Use ascii_letters instead of letters.
The latter is locale-dependent and not available on Py3.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
01565fa6c5 Added tests to verify a couple of incomplete encodings. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
60841c6567 Added regression test on bool adaptation. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
beba064983 Test on basic adapters pass on Python 3. 2010-12-31 03:18:26 +01:00
Daniele Varrazzo
89e4d4c7bb Empty lists correctly roundtrip. 2010-12-31 03:18:26 +01:00
Daniele Varrazzo
ade1b2cc7b Test suite converted into a proper package.
Dropped cyclic import from modules to tests: they were only working
because a second copy of the package was found in the project dir.
Use relative import so that 2to3 can do a good conversion.
2010-12-21 05:02:19 +00:00
Daniele Varrazzo
b96dcef8a2 Fixed PG -> Py encodings mapping with non-alnum chars.
We mangle the encoding names a little bit before asking it to the
backend: be sure to be able to find the equivalent Python code back or
decoding (unicode cast or Py3) will barf.
2010-12-21 04:02:14 +00:00
Daniele Varrazzo
31093a7a58 Some light cleanup for Py3 conversion.
Either flagged as warning by python2.6 -3 or converted by 2to3.
2010-12-21 04:02:13 +00:00
Daniele Varrazzo
cf243ccf37 Shorter "never ending query" to test query canceling.
If the cancel signal misses the race, this query will stay in the
backend until the sleep expires.
2010-12-04 23:21:16 +00:00
Daniele Varrazzo
46a5f140c7 Bail out early from tests if connection to the test db fails. 2010-12-01 20:56:25 +00:00
Daniele Varrazzo
0ad7483a2b DictRow items can be updated. Patch by Alex Aster. 2010-12-01 13:17:12 +00:00
Daniele Varrazzo
361786f4a8 More careful connections handling during tests. 2010-11-28 17:29:37 +00:00
Daniele Varrazzo
598b9424d2 Deal uniformly with test servers without pg_sleep. 2010-11-28 17:29:36 +00:00
Daniele Varrazzo
2b6d2017ed Added paranoia test to check we haven't broken gil release.
Got scared testing cancel with a signal as it doesn't work. But probably
signals are not deliveded to Python in the middle of an opcode.
2010-11-28 17:29:35 +00:00
Daniele Varrazzo
0c7b0a943b A prepared connection can't be canceled. 2010-11-28 12:15:26 +00:00
Jan Urbański
751bfa1ea6 Support query cancellation.
Add a cancel() method do the connection object that will interrupt
the current query using the libpq PQcancel() function.
2010-11-28 11:50:02 +00:00
Daniele Varrazzo
9f78141532 Don't consider the kernel not blocking us on write as an error. 2010-11-25 03:13:49 +00:00
Daniele Varrazzo
5a025825cc Skip test if uuid not available on Python. 2010-11-24 11:04:18 +00:00
Daniele Varrazzo
bb44bcd5b5 Skipped inf test on the platform not supporting it (win32). 2010-11-24 10:50:28 +00:00
Daniele Varrazzo
ed3b2188fe Fixed import of test functions from Python 2.7 unittest. 2010-11-19 18:01:29 +00:00
Daniele Varrazzo
bbe28ba75f Add a small delay to receive notification when testing on busy network. 2010-11-19 14:44:47 +00:00
Daniele Varrazzo
21dfc2c592 Float test skipped where the server doesn't support inf. 2010-11-19 10:44:39 +00:00
Daniele Varrazzo
a55e50b991 hstore test passes against non-utf8 databases. 2010-11-19 10:29:07 +00:00
Daniele Varrazzo
19ead4a5cb Test cleanup.
Tests pass or fail gracefully on older PostgreSQL versions.

If unittest2 is available, skip tests instead of printing warnings.
2010-11-19 03:55:37 +00:00
Daniele Varrazzo
bcacdc8461 Added enum with possilbe isolation level states.
Also, general isolation levels cleanup and tests added.
2010-11-18 00:31:51 +00:00
Daniele Varrazzo
9849083628 Added tests to check the effective isolation level. 2010-11-17 01:04:34 +00:00
Daniele Varrazzo
cd19f9115d Fixed notices order (ticket #9). 2010-11-11 11:54:43 +00:00
Daniele Varrazzo
3cae0f3f5d NamedTupleCursor doesn't change exception when fetching with no result. 2010-11-11 10:39:42 +00:00
Daniele Varrazzo
ef7a5ee8a9 Build the namedtuple only once per execution, not once per fetch. 2010-11-11 10:39:42 +00:00
Daniele Varrazzo
11c021cb21 Fixed tests to run on Windows. 2010-11-11 10:39:35 +00:00
Daniele Varrazzo
9fe0511711 Silencing other 2 tests failures due to 2pc disabled in the server. 2010-11-09 01:44:42 +00:00
Daniele Varrazzo
0d318179a9 Fixed test syntax for py 2.4. 2010-11-09 00:09:32 +00:00
Daniele Varrazzo
62d3a1533b Use the adapter of an object superclass if available. 2010-11-08 01:35:06 +00:00
Daniele Varrazzo
7276c4a6b1 Tests fail gracefully if tpc is supported but disabled by the server. 2010-11-08 01:28:00 +00:00
Daniele Varrazzo
abad3127ca Added NamedTupleCursor. 2010-11-06 04:33:44 +00:00
Daniele Varrazzo
985425fb38 Added test to verify the ticket #7 is fixed. 2010-11-06 02:24:28 +00:00
Daniele Varrazzo
77c0ab02d8 The Notify type is hashable.
If there is no payload, hash the same way the equivalent 2-tuple does.
Otherwise hash on the payload too.
2010-11-05 09:34:52 +00:00
Daniele Varrazzo
56ae1fe4bf Payload default is the empty string. 2010-11-05 09:34:52 +00:00
Daniele Varrazzo
9c58c01e0f Added comparison between Notify objects and Notify or tuple.
Explicit comparison with the tuple is required if we want to make
Notify() == (pid, channel) work: item access is not enough (and a test
in the suite fails if we get this wrong).
2010-11-05 09:34:52 +00:00
Daniele Varrazzo
1b100b5cbf Skip tests if the hstore type is not in the test database. 2010-11-05 09:34:52 +00:00
Daniele Varrazzo
d5bf400cb4 The hstore typecast can be registered globally. 2010-11-05 09:34:52 +00:00
Daniele Varrazzo
ed623776f3 Hstore can return unicode keys and values. 2010-11-05 09:34:51 +00:00
Daniele Varrazzo
00e005b77d Added test to verify dict roundtrip with hstore. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
af835f8857 Correctly parse escaped quotes from hstore.
Parse regexp simplified.
2010-11-05 09:34:50 +00:00
Daniele Varrazzo
6d441b6e03 Added hstore typecaster registration. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
fef9727cce parse_hstore converted in class method. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
5844e989c4 Added function to parse an hstore into a dict. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
5693c9cab1 Added implementation of python dict adapter to hstore. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
3e658c33b5 Ensure unicode is accepted as type for transaction ids.
We don't do somersaults to ensure people can use snowmen as transaction
ids anyway: it would require passing the connection to xid_ensure and
down below to use the correct encoding.
2010-11-05 09:34:50 +00:00
Daniele Varrazzo
4f3976681a Added Xid.from_string() constructor.
It exposes the parsing rules used in restore.
2010-11-05 09:34:49 +00:00
Daniele Varrazzo
774be1d616 Dropped XID_UNPARSED: we use format_id = None for PG xact ids. 2010-11-05 09:34:49 +00:00
Daniele Varrazzo
978cac3a1b XA transaction ids can be decoded from PostgreSQL transaction ids. 2010-11-05 09:34:48 +00:00
Daniele Varrazzo
c0c116dcc4 Use pgjdbc algorithm to convert XA xids into strings. 2010-11-05 09:34:48 +00:00
Daniele Varrazzo
397eace051 Added tests for two-phase commit/rollback. 2010-11-05 09:34:48 +00:00
Daniele Varrazzo
56c02b0f94 Added tpc_recover method. 2010-11-05 09:34:48 +00:00
Daniele Varrazzo
8bfd34faf2 hook up two phase commit tests.
By James Henstridge on 2008-07-24.

Merged from lp:~jamesh/psycopg/two-phase-commit/revision/359
2010-11-05 09:34:47 +00:00
Daniele Varrazzo
e863222b5c beginnings of a TPC test harness
By James Henstridge on 2008-05-12.

Merged from lp:~jamesh/psycopg/two-phase-commit/revision/354
2010-11-05 09:34:47 +00:00
Daniele Varrazzo
4ec298e112 Notify object exposed in the extensions module. 2010-11-05 09:34:47 +00:00
Daniele Varrazzo
f435d15c95 Adding Notify object with payload. 2010-11-05 09:34:46 +00:00
Daniele Varrazzo
e651308287 Check the correctness of the PID in the notify tests. 2010-11-05 09:34:46 +00:00
Daniele Varrazzo
bc2aefeacf cursor.mogrify() accepts unicode queries. 2010-10-05 03:13:44 +01:00
Daniele Varrazzo
575b2b5f77 The Inet type knows how to adapt itself.
Implemented __conform__ as the Adaptation PEP suggests. It is not
required for the type to be registered as adapter.
2010-09-25 23:55:55 +01:00
Daniele Varrazzo
b072a04c9c DBAPI compatibility test updated to 1.12.
Nothing major: Python 3.0 compatibility fixes.
2010-09-23 23:36:58 +01:00