Commit Graph

74 Commits

Author SHA1 Message Date
Daniele Varrazzo
c9fd828f8a Allow make_dsn to take no parameter
The behaviour of connect() is unchanged: either dsn or params must be
specified.
2016-03-03 17:09:15 +00:00
Daniele Varrazzo
7aab934ae5 Validate output result from make_dsn()
The output is not necessarily munged anyway: if no keyword is passed,
validate the input but return it untouched.
2016-03-03 17:09:15 +00:00
Daniele Varrazzo
7155d06cdc Test that the empty dsn is a valid make_dsn input 2016-03-03 17:09:15 +00:00
Daniele Varrazzo
52087a79d9 Added test suite specific for make_dsn 2016-03-03 15:31:37 +00:00
Daniele Varrazzo
7e94ce1f14 Drop spurious notices in test
Getting some "rehashing catalog" debug messages in PG 9.4
2015-10-01 13:31:13 +01:00
Daniele Varrazzo
5afeee3613 Added unicode support to parse_dsn
Also added support for the argument as a keyword.
2015-10-01 13:20:11 +01:00
Daniele Varrazzo
71d96293ab Fixed parse_dsn tests on Python 3
On Python 3 there is no Exception.message attribute.
2015-10-01 12:03:00 +01:00
Daniele Varrazzo
d3bbd19ccb Separate parse_dsn test in a test case of their own 2015-10-01 11:52:42 +01:00
Daniele Varrazzo
d1af12187c Merge branch 'master' into parse-dsn 2015-10-01 11:39:51 +01:00
Daniele Varrazzo
6803341f21 Report NotSupportedError for PGRES_COPY_BOTH and PGRES_SINGLE_TUPLE
Fixes #352.
2015-09-30 12:28:07 +01:00
Daniele Varrazzo
1f330e9cac Allow connection.notices and notifies to be replaced.
Close #326
2015-06-02 17:02:04 +01:00
Oleksandr Shulgin
d6041271bc Separate parse_dsn test on URI, for libpq >= 9.2 2015-06-02 14:02:29 +02:00
Oleksandr Shulgin
3200cd77bf One more parse_dsn test for unquoted space 2015-06-01 15:18:03 +02:00
Oleksandr Shulgin
6a2f21aa14 Move parse_dsn to extensions, add tests 2015-06-01 15:11:12 +02:00
Daniele Varrazzo
6210af2763 Fixed excessively strict notices test
Failing with PG 9.4 because it generates other debug messages during the
test run (rehashing catalog cache).
2014-08-31 03:06:33 +01:00
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
Daniele Varrazzo
69605e54ec Fixed explicit connection.cursor(cursor_factory=None)
Fixes issue #210.
2014-04-30 17:57:55 +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
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