Daniele Varrazzo
a3063900ee
Fixed code flow in encrypt_password()
...
Fixed several shortcomings highlighted in #576 and not fixed as
requested.
Also fixed broken behaviour of ignoring the algorithm if the connection
is missing.
2018-05-20 19:18:42 +01:00
Ashesh Vashi
1bec2bdc43
Merge branch 'master' into master
2018-05-08 15:17:59 +05:30
Daniele Varrazzo
ea923b63a4
Allow strings subclasses in ensure_bytes
...
Fix #679
2018-02-21 10:27:28 +00:00
Daniele Varrazzo
76f3e196d3
Silence warning on import failing a test
2018-01-29 03:23:59 +00:00
Daniele Varrazzo
74d2c4bef9
Fixed idempotence check changing connection characteristics
2018-01-11 02:23:27 +00:00
Jon Dufresne
1a8e992fcc
Use relative imports throughout tests
...
The tests relied on Python2 relative import semantics. Python3 changed
import semantics to always search sys.path by default. To import using a
relative path it must have a leading dot.
Forward compatible with newer Pythons.
Works towards the goal of moving tests outside of the installed package.
For more information, see PEP-328:
https://www.python.org/dev/peps/pep-0328/
2017-12-10 10:51:07 -08:00
Jon Dufresne
699be52e8b
Remove unnecessary script_to_py3; make scripts compatible instead
...
Part of the work towards moving tests out of the installed package.
2017-12-01 22:50:16 -08:00
Hugo
ffcc65d4f0
Drop support for EOL Python 2.6
2017-11-28 16:02:12 +00:00
Jon Dufresne
390e43fcb1
Use modern except syntax throughout project
...
The syntax "except Exception, exc:" is deprecated. All Python versions
supported by psycopg2 support the newer, modern syntax. Forward
compatible with future Python versions.
2017-11-20 20:00:35 -08:00
Ashesh Vashi
84d405894c
Moving the encrypt_password method from the connection class to the
...
psycopgmodule, and exported it from psycopg2.extensions as per review
comments.
2017-09-14 23:42:54 +05:30
Ashesh Vashi
6e0edf7779
Merge remote-tracking branch 'psycopg2/master'
2017-09-11 18:26:34 +05:30
Daniele Varrazzo
d619baf000
Skipped a couple of test with unsupported postgres features
2017-07-22 02:09:24 +01:00
Ashesh Vashi
e089d94c88
'encrypt_password' raises 'psycopg2.NotSupportedErorr' exception for
...
server version >= 10, when compiled using libpq version < 10, when no
algorithm is specified.
2017-07-17 11:46:50 +05:30
Ashesh Vashi
2c1966a7f6
When compiled with libpq version < 10, it raises 'psycopg2.NotSupportedError' (not, psycopg2.ProgrammingError).
2017-07-17 11:06:55 +05:30
Ashesh Vashi
cfb0937605
Added support for preparing the encrypted password of a PostgreSQL
...
password using the libpq functions - 'PQencryptPasswordConn', and
'PQencryptPassword'.
2017-07-17 10:32:59 +05:30
Daniele Varrazzo
30d89da4fa
Ignore spurious output in test with Python debug build
2017-06-17 03:20:09 +01:00
Daniele Varrazzo
7ae2cb5cd0
Don't force a valid return code for the test
...
Windows returns 22, Linux returns 1
2017-06-15 17:39:00 +01:00
Daniele Varrazzo
de843ef756
Added test to reproduce bug #551
2017-06-15 17:22:32 +01:00
Daniele Varrazzo
9f160fd820
Obscure the password on url dsn too
...
Note that we don't leak anymore the password length.
Fix #528
2017-03-16 03:53:40 +00:00
Daniele Varrazzo
cc047a445a
Added tests to verify the password is obscured
...
The url test fails: see issue #528
2017-03-15 16:00:40 +00:00
Daniele Varrazzo
8e28444897
Bunch of test tweaks to make the test grid green
2017-03-14 14:15:52 +00:00
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