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
af18c29f0b
Fixed exception handling in disconnection test
...
OperationalError is DatabaseError's subclass.
2013-03-16 21:43:11 +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
Catalin Iacob
7abe1775d0
Fix tests for Postgres 9.3
...
Postgres 9.3 turns messages about implicit indexes and sequences from NOTICE
to DEBUG1 so the tests fail with a default 9.3 server configuration because
the client doesn't get any NOTICE. Fix it by also asking for DEBUG1 messages
from the server when testing against Postgres >= 9.3.
2013-03-16 00:54:11 +00:00
Daniele Varrazzo
91c2ff9296
Fixed tpc_recover() with RealDictStuff
...
Same problem and correction of ticket #114 .
2012-08-14 23:29:19 +01:00
Daniele Varrazzo
84f2a370f6
close() methods don't raise errors if called on closed objects
2012-03-04 05:10:07 +00:00
Daniele Varrazzo
5fcbe7bd0f
Check/set connection status at commit inside the critical section
...
Failing to do so was causing the issue reported in ticket #103 . The issue
as reported was fixed when SET ISOLATION LEVEL was dropped, but the real
problem wasn't fixed.
2012-02-24 03:28:20 +00:00
Daniele Varrazzo
702ae0a904
Force GC during weakref tests
...
Required to run the tests under PyPy with no refcount. See
https://github.com/mvantellingen/psycopg2-ctypes/pull/15#issuecomment-3274618
2011-12-26 22:35:33 +01:00
Daniele Varrazzo
b5de04d2ff
Put back a distinct ISOLATION_LEVEL_READ_UNCOMMITTED value
2011-12-15 12:53:48 +00:00
Federico Di Gregorio
d2d94e203f
Reverted isolation level values to backward compatible values
...
This basically removes the READ UNCOMMITED level (that internally
PostgreSQL maps to READ COMMITED anyway) to keep the numeric values
compattible with old psycopg versions. For full details and discussion
see this thread:
http://archives.postgresql.org/psycopg/2011-12/msg00008.php
2011-12-15 12:25:19 +01:00
Daniele Varrazzo
dc94a3cb2d
Check for connection closed before getting the isolation level
...
Closes ticket #74
Also added test to check regressions in isolation_level,
set_isolation_level, set_session, autocommit.
2011-11-16 23:51:05 +00:00
Daniele Varrazzo
d2b28abced
Method set_transaction() renamed to set_session()
...
In fact it doesn't change "the transaction", as there has to be no
transaction when invoked. The effect instead is to execute SET SESSION
CHARACTERISTICS.
2011-06-08 14:22:11 +01:00
Daniele Varrazzo
3aad3d3143
Fixed test to run on Python <= 2.5
...
tuple.index() is not available on these versions.
2011-06-03 09:31:06 +01:00
Daniele Varrazzo
4d3c6865ee
Use only the isolation levels available on old PG versions
2011-06-03 00:40:54 +01:00
Daniele Varrazzo
389f2cf1d0
Added autocommit property on connection
2011-06-02 01:16:22 +01:00
Daniele Varrazzo
ea03ffbf76
Added partial implementation for set_transaction
...
autocommit to be implemented yet.
2011-06-01 09:07:02 +01:00
Daniele Varrazzo
19ec8809fd
Use all the isolation levels accepted by PostgreSQL
...
In PG 9.1 repeatable read and serializable are distinct levels.
2011-05-11 13:01:20 +01:00
Daniele Varrazzo
88803695ac
Normalize the encoding name at connection
...
The encoding can be set by PGCLIENTENCODING, which may be an alternative
spelling. Bug reported by Peter Eisentraut.
At this point the idea of considering one of the random spellings such as
EUC_CN as somewhat "blessed" is debunked. So just store the cleaned-up
version of the encoding in the mapping table. Note that the cleaned-up
version was needed by the unicode adapter: this requirement has been
surpassed as the connection now contains a copy of the Python codec name
set whenever the client encoding is set.
2011-04-08 13:48:11 +01:00
Jason Erickson
4fdc22451e
Merge branch 'devel' of github.com:jerickso/psycopg into devel
2011-02-18 13:08:33 -07:00
Jason Erickson
9dc6811135
Again, increase timeout on concurrent_exec tests
...
Truly increase the sleep timeout to 4 seconds and the check to 7. Previous
commit message indicated that, but reality was different.
2011-02-18 11:52:17 -07:00
Daniele Varrazzo
7756eae573
Merge remote branch 'jason/devel' into devel
2011-02-17 11:50:14 +00:00
Daniele Varrazzo
c96ba553da
Cleanup of skipping of testing methods on certain Py/PG versions
2011-02-15 17:11:07 +00:00
Jason Erickson
7c9d8192a3
Increase timeout on concurrent_execution test
...
With test_concurrent_execution test, checking two threads issuing a pg_sleep
of 2 seconds and and check if they complete in under 3 seconds occasionally
fails when the test is run in a virtual machine on a VM Server with other
virtual machines running. Increased the sleep to 4, and the check to 7,
giving 3 seconds buffer instead of 1 second.
2011-02-14 16:31:31 -07:00
Jason Erickson
b075017ad9
Pulled down changes from dvarrazzo branch on gh
...
Pulled the master branch from of Daniele's psycopg branch on github and
merged the changes.
2011-02-10 15:59:31 -07:00
Jason Erickson
88cc5a986d
Use tests.dsn for the dsn connection string
...
Using self.conn.dsn as the dsn connection string actually has the password
'x'ed out. The initial connection replaces the password with 'x' to
obfuscate it. Using tests.dsn instead of self.conn.dsn ensures that the
correct connection string is used.
2011-02-02 17:14:29 -07: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
7c1b03bd45
All tests made executable.
2011-01-07 00:58:29 +00:00
Daniele Varrazzo
04cf90cc21
The connection is weakly referenceable
2011-01-03 21:34:49 +01: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
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
0d318179a9
Fixed test syntax for py 2.4.
2010-11-09 00:09:32 +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
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
df959c20be
Making sync and async connection setup somewhat more consistent.
2010-04-23 13:24:35 +01:00
Daniele Varrazzo
d71520db9a
Read the server version only after connection established.
2010-04-21 15:31:07 +01:00