Daniele Varrazzo
44d8edfd8c
Ignore None arguments passed to make_dsn()
...
Close #517 .
2017-03-01 20:12:13 +00:00
Daniele Varrazzo
d50ed48807
Added readonly and deferrable attributes
2017-02-16 12:46:35 +00:00
Daniele Varrazzo
b5d80b609d
Revert pre-2.7b1 behaviour of silent rollback on conn.set_isolation_level()
...
Legacy method is legacy.
2017-02-16 12:46:35 +00:00
Daniele Varrazzo
20c9c17457
connection.isolation_level is now writable
2017-02-16 12:46:35 +00:00
Daniele Varrazzo
28c489f17e
Merge branch 'no-set-default-session'
2017-02-07 00:58:54 +00:00
Daniele Varrazzo
e599da6308
assertDsnEqual moved as TestSuite method
2017-02-06 21:40:05 +00:00
Daniele Varrazzo
9054eeccc0
Set default_transaction_* GUC if session state is changed in autocomit
2017-02-04 15:19:41 +00:00
Daniele Varrazzo
665e9dc665
Exposing ISOLATION_LEVEL_DEFAULT to Python
...
This is now the state that is returned to Python if nothing has been
explicitly set.
2017-02-04 14:43:54 +00:00
Daniele Varrazzo
ca59fd8b3f
Test looking the transactions characteristics instead of the default
...
So we test the effect, not the implementation. Tests pass on master too
this way, three tests fail in this branch, related to autocommit
(sort-of-obviously).
2017-02-04 10:57:30 +00:00
Daniele Varrazzo
1911b250e3
Merge branch 'async-keyword'
...
Close #495
2017-02-03 04:45:17 +00:00
Daniele Varrazzo
ce9be69615
Added async_ as an alias for async
...
Added in argument for psycopg2.connect() and connection.__init__, and
for the connection.async attribute.
2017-02-03 04:43:49 +00:00
Daniele Varrazzo
d8b1fbd905
Further skipping of slow tests
2017-02-02 03:02:29 +00:00
Daniele Varrazzo
f24de0357f
Allow skipping the slow test
...
It's not so much about tests being slow: some just get stuck and timeout
travis.
Skipped all tests taking about more than 0.2s to run on my laptop.
Fast testing takes about 8s instead of 24.
2017-02-02 01:53:50 +00:00
Daniele Varrazzo
a478ba9a47
Fixed tests failing on Python 2.6
2016-12-24 01:03:57 +01:00
Daniele Varrazzo
91d2158de7
Python source cleanup using flake8
2016-10-11 00:11:55 +01:00
Daniele Varrazzo
2a4d6027a4
Merge branch 'master' into replication-protocol
...
Conflicts:
tests/testconfig.py
2016-08-07 01:53:21 +01:00
Daniele Varrazzo
7566af145b
Merge branch 'conn-get-parameters'
2016-07-01 20:12:01 +01:00
Oleksandr Shulgin
cb7032554e
Merge branch 'master' into feature/replication-protocol-c-connection-object
2016-03-04 10:52:10 +01:00
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
Oleksandr Shulgin
051e6d1364
Add skip_before_libpq for test_get_dsn_parameters
2015-10-30 13:02:45 +01:00
Oleksandr Shulgin
602fefcae3
Fix typo in a new test name
2015-10-30 11:38:28 +01:00
Oleksandr Shulgin
a4cbb088fe
Add connection.get_dsn_parameters()
2015-10-30 11:10:41 +01:00
Oleksandr Shulgin
cf4f2411bf
Fix async replication and test.
2015-10-15 18:01:43 +02:00
Oleksandr Shulgin
d14fea31a3
Use quote_ident from psycopg2.extensions
2015-10-15 12:56:21 +02:00
Oleksandr Shulgin
a0b42a12ff
Update stop_repl, require replication consumer to be a callable.
2015-10-14 15:15:07 +02:00
Oleksandr Shulgin
fea2260fc5
Fix stop_replication: always raise outside the loop.
2015-10-14 12:50:08 +02:00
Oleksandr Shulgin
54079072db
Fix ReplicationTest: no NotSupportedError now.
2015-10-14 12:43:26 +02: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
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
Daniele Varrazzo
12ef826d50
Dropped redundant call to conn_notice_process().
...
If the connection is sync, notices will be processed by pq_fetch()
downstream.
If the connection is async, here we have only sent the query: no result
is ready yet, and neither notices have had a chance to arrive: they will
be retrieved later by pq_is_busy().
Added tests to check the above statement don't break.
2010-04-21 15:09:14 +01:00
Federico Di Gregorio
611606d532
Changes license to LGPL3 + OpenSSL exception on all source files
2010-02-12 23:34:53 +01:00
Federico Di Gregorio
36aff2f73d
Implemented connection.reset()
2009-08-09 16:19:08 +02:00
James Henstridge
2f3f4c1258
2008-04-21 Jorgen Austvik <Jorgen.Austvik@sun.com>
...
* tests/*.py: use the DSN constructed in tests/__init__.py.
* tests/__init__.py: allow setting the host, port and user for the
DSN used by the tests through the environment.
2008-04-20 23:12:21 +00:00
James Henstridge
3265dd172d
* tests/test_connection.py (ConnectionTests): add simple tests for
...
the Connection and Cursor "closed" attributes.
* psycopg/cursor_type.c (psyco_curs_get_closed): add a "closed"
attribute to cursors. It will be True if either the cursor or its
associated connection are closed. This fixes bug #164 .
2008-01-19 03:32:42 +00:00