Daniele Varrazzo
068b15c57f
Merge branch 'fix-716'
2018-05-20 17:00:13 +01:00
Daniele Varrazzo
c4da939909
Don't raise an exception closing an unused named cursor
...
Close #716
2018-05-20 14:00:09 +01:00
Daniele Varrazzo
49d9edce01
Set minimal postgres version for intervalstyle test
2018-05-20 13:40:57 +01:00
Daniele Varrazzo
3f389593f5
Raise NotSupportedError fetching iso_8601 intervals
...
Previously it would have failed parsing and resulted in ValueError
Close #707
2018-05-20 13:22:38 +01:00
Daniele Varrazzo
098c00d73e
Merge remote-tracking branch 'nested-array-nulls'
2018-05-20 12:51:13 +01:00
Daniele Varrazzo
dd7e5c906f
Skipped test on db version not supporting unicode identifiers
2018-05-18 12:16:43 +01:00
Daniele Varrazzo
bc84b6233e
Allow non-ascii chars in namedtuple fields
...
They can be valid chars in Python 3. Or maybe not? In which case Python
will throw an exception, but that's fine.
Fix regression introduced fixing #211
2018-05-18 12:15:50 +01:00
Daniele Varrazzo
8dd00ee874
Hstore test fixed after adapting arrays dropped space after commas
2018-05-18 12:11:02 +01:00
Daniele Varrazzo
b5e4a040f8
Fixed adaptation of arrays of arrays of nulls
...
Close #325 , close #706 .
2018-05-18 12:10:20 +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
ddb87b7727
Convert fields names into valid Python identifiers in NamedTupleCursor
...
Close #211 .
2018-01-29 03:30:46 +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
Daniele Varrazzo
6da3e7ee69
Merge branch 'mogrify-on-closed-cursor'
2018-01-11 00:16:01 +00:00
Daniele Varrazzo
a78ac3c125
Fixed test in asian time zones
...
Fix #652
2018-01-10 23:58:28 +00:00
Daniele Varrazzo
e0226fc46a
'cursor.mogrify()' can be called on closed cursors
...
Fix #579 .
2018-01-11 08:55:31 +09:00
Jon Dufresne
be3b1ba1eb
In tests, use compat.py where there is overlap
2017-12-11 20:27:52 -08:00
Jon Dufresne
389f6c08d9
Avoid installing tests to site-packages
...
For library end users, there is no need to install tests alongside the
package itself. This keeps the tests available for development without
adding extra packages to user's site-packages directory. Reduces the
size of the installed package. Avoids accidental execution of test code
by an installed package.
2017-12-10 10:55:58 -08:00
Jon Dufresne
c86e682153
Skip register_hstore(..., unicode=True) tests on Python 3
...
Per the functions documentation, this argument is not supported on
Python 3. Skip it during tests.
> :param unicode: if `!True`, keys and values returned from the database
> will be `!unicode` instead of `!str`. The option is not available on
> Python 3
Work towards moving tests outside of the installed package.
2017-12-10 10:51:07 -08: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
9de46e416e
Use print() function instead of print statement throughout project
...
Forward compatible with newer Pythons.
2017-12-10 10:51:07 -08:00
Jon Dufresne
ef64493b89
Fix use of "async" in test_cursor.py
...
"async" will be a keyword starting with Python 3.7. On Python 3.6, use
of "async" causes a deprecation warning. Use the alias "async_" instead.
2017-12-10 10:49:04 -08:00
Daniele Varrazzo
2218e73c28
Merge branch 'master' into ws
2017-12-02 14:47:29 +00:00
Daniele Varrazzo
06396e5162
Merge remote-tracking branch 'jdufresne/import-unittest'
2017-12-02 12:10:26 +00:00
Daniele Varrazzo
aae5d6364f
Merge remote-tracking branch 'jdufresne/leading0'
2017-12-02 12:07:57 +00:00
Daniele Varrazzo
5a3cf32fe5
Merge remote-tracking branch 'jdufresne/next-func'
2017-12-02 12:07:47 +00:00
Daniele Varrazzo
2c5cad1525
Merge remote-tracking branch 'jdufresne/more-json'
2017-12-02 12:07:06 +00: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
Jon Dufresne
e335d6d223
Trim trailing whitespace from all files throughout project
...
Many editors automatically trim whitespace on save. By trimming all
files in one go, makes future diffs cleaner without extraneous
whitespace changes.
2017-12-01 21:42:14 -08:00
Jon Dufresne
d0c7126aa8
Remove test decorators for json module
...
The json module is available in all Python versions supported by
psycopg2. No need to check for its presence when executing tests.
Should have been included with d58844e548
but was missed.
2017-12-01 21:06:10 -08:00
Jon Dufresne
f5703dc3e5
Use builtin function next() throughout project
...
Available since Python 2.6. Use of .next() is deprecated and not
supported in Python 3. Forward compatible with modern Python.
https://docs.python.org/2/library/functions.html#next
2017-12-01 19:57:37 -08:00
Jon Dufresne
56ec575351
Drop leading 0's from numeric literals
...
Not compatible with Python3. Makes the code more forward compatible with
modern Pythons.
In Python2, it was an alternative syntax for octal.
$ python3
>>> 01
File "<stdin>", line 1
01
^
SyntaxError: invalid token
2017-12-01 19:00:53 -08:00
Jon Dufresne
fcc083dc12
Always import the system unittest
...
There is no need to import testutils.unittest instead of simply
unittest. They are simple aliases. Use system unittest to be more
regular, consistent as well as idiomatic with the wider Python
community.
2017-12-01 18:35:30 -08:00
Daniele Varrazzo
65ed5478d1
Collect rowcount in executemany even when discarding results
...
Closes #633 .
2017-11-29 15:42:04 +00:00
Daniele Varrazzo
c3ee9cac41
Dropped unused test functions
2017-11-28 16:11:06 +00:00
Hugo
283de27098
Remove redundant parentheses
2017-11-28 16:06:52 +00:00
Hugo
7282ef0d14
Rewrite list creation as list literal
2017-11-28 16:03:23 +00:00
Hugo
955526b200
Replace comparison with None with equality operator
2017-11-28 16:03:23 +00:00
Hugo
53c1c5dcc1
Remove redundant hasattr checks
2017-11-28 16:03:23 +00:00
Hugo
ffcc65d4f0
Drop support for EOL Python 2.6
2017-11-28 16:02:12 +00:00
Jon Dufresne
4c95668c72
Remove "from __future__ import with_statement"
...
All versions of Python supported by psycopg2 have builtin support for
the with statement. The import is unnecessary noise.
2017-11-28 06:03:46 -08:00
Daniele Varrazzo
fc8574fdd8
Merge remote-tracking branch 'jdufresne/decimal'
2017-11-28 03:05:06 +00:00
Daniele Varrazzo
e0ce35ef72
Merge remote-tracking branch 'jdufresne/skip-before'
2017-11-28 03:04:44 +00:00
Daniele Varrazzo
db0c081d03
Merge remote-tracking branch 'jdufresne/uuid'
2017-11-28 03:04:26 +00:00
Daniele Varrazzo
a39d794308
Merge remote-tracking branch 'jdufresne/iobase'
2017-11-28 03:04:03 +00:00
Jon Dufresne
048f1bb95a
Remove workaround for decimal module
...
The decimal module is available on all Python versions supported by
psycopg2. It has been available since Python 2.4. No need to catch an
ImportError.
https://docs.python.org/2/library/decimal.html
2017-11-26 17:55:24 -08:00
Jon Dufresne
dfc9932f27
Remove use of skip_before_python for unsupported Python versions
...
psycopg2 does not support Python < 2.6, remove all test guards for these
versions.
2017-11-26 16:43:18 -08:00
Jon Dufresne
582ec189cc
Remove uuid workaround for older Pythons
...
uuid is available on all Python versions supported by psycopg2.
2017-11-26 14:46:53 -08:00
Jon Dufresne
f7d5d25651
Remove io.TextIOBase workaround for Python <= 2.5
...
io.TextIOBase is available on all Python versions supported by psycopg2.
Can remove all workarounds.
2017-11-26 14:32:35 -08:00
Jon Dufresne
05c28cce78
Remove workarounds for namedtuple on Python <= 2.5
...
namedtuple is available on all Python versions supported by psycopg2. It
was first introduced in Python 2.6. Can remove all workarounds and
special documentation.
2017-11-26 13:55:30 -08: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
Federico Di Gregorio
5983b96c55
Don't cast point arrays to float arrays ( fixes : #613 )
2017-11-16 10:07:27 +01: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
775de754cf
Added back timestamptz[] default cast
...
It was registered as side effect of an excessive definition that got
cleaned up in 338dbe70a6
.
Looking at other removed redundant type oids, this was the only one
missing from the `string_types` map.
Close #578 .
2017-07-24 14:23:36 +01:00
Daniele Varrazzo
cfa0509d7e
Deal with E'' strings comparisons in a few other tests
2017-07-22 03:15:06 +01:00
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
d2e86db8fb
Merge branch 'fix-554'
2017-06-17 03:34:01 +01:00
Daniele Varrazzo
1a97445471
Accept Composable in start_replication_expert()
...
Close #554
2017-06-17 03:30:44 +01:00
Daniele Varrazzo
30d89da4fa
Ignore spurious output in test with Python debug build
2017-06-17 03:20:09 +01:00
Daniele Varrazzo
2b5e131831
Merge branch 'fix-558'
2017-06-16 19:41:52 +01:00
Daniele Varrazzo
70a2d2238e
Consider redshift interval supported after further tests
2017-06-16 19:39:18 +01:00
Daniele Varrazzo
789eb64f3a
Added Json.prepare()
...
Close #562
2017-06-16 01:37:49 +01:00
Daniele Varrazzo
315f72862c
Parse a number as microseconds when casting interval
...
Should close #558 , but I'm curious to know if a number is returned
for interval < 1 day too (which wouldn't trigger the overflow, but will
finish parsing with part=0).
2017-06-16 00:54:38 +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
6e5abf33f2
Merge branch 'fix-547'
2017-04-19 01:34:39 +01:00
Daniele Varrazzo
a7e3f46431
Merge remote-tracking branch 'fix_lobject_factory'
2017-04-19 01:06:24 +01:00
Daniele Varrazzo
248e653c9e
Fixed args parsing in ReplicationCursor.consume_stream()
...
Close #547 .
2017-04-19 01:01:59 +01:00
Frazer McLean
9e5621698f
Python < 3.2 doesn’t have assertIsInstance
2017-04-16 03:44:21 +02:00
Frazer McLean
7b3ea43e92
Handle lobject mode=None correctly
2017-04-16 03:20:31 +02:00
Frazer McLean
38cd720369
Fix name of lobject keyword argument
2017-04-16 03:12:18 +02:00
Daniele Varrazzo
cd095ef0ee
Added test to verify callback errors in named cursors
...
They work fine.
2017-04-05 14:54:07 +01:00
Daniele Varrazzo
47f5e97759
Added test to verify #410
...
The 'unknown error' happens on query.
2017-04-05 14:54:07 +01:00
Daniele Varrazzo
7214c6652e
Return objects with timezone parsing infinity timestamptz
...
Close #536 .
2017-03-22 03:03:02 +00:00
Daniele Varrazzo
f9b36433fb
Merge branch 'fix-528'
2017-03-16 04:24:17 +00: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
3bfbd3a0a5
Added test to verify sql objects work with copy_expert()
...
I'll be honest: I lucked out, I didn't think about this combination. But
maybe sheer luck, maybe using common code paths, it just works. Let's
make it stays so.
2017-03-16 00:55:20 +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
Greg Ward
12317557da
Always raise OperationalError when connection was closed externally.
...
From the DB-API (https://www.python.org/dev/peps/pep-0249/ ):
OperationalError
Exception raised for errors that are related to the database's
operation and not necessarily under the control of the programmer,
e.g. an unexpected disconnect occurs, [...]
Additionally, psycopg2 was inconsistent, at least in the async case:
depending on how the "connection closed" error was reported from the
kernel to libpq, it would sometimes raise OperationalError and
sometimes DatabaseError. Now it always raises OperationalError.
2017-03-14 12:14:00 +00:00
Greg Ward
b203a7c775
Always detect when a connection is closed behind psycopg2's back.
...
There's a race condition that only seems to happen over Unix-domain
sockets. Sometimes, the closed socket is reported by the kernel to
libpq like this (captured with strace):
sendto(3, "Q\0\0\0\34select pg_backend_pid()\0", 29, MSG_NOSIGNAL, NULL, 0) = 29
recvfrom(3, "E\0\0\0mSFATAL\0C57P01\0Mterminating "..., 16384, 0, NULL, NULL) = 110
recvfrom(3, 0x12d0330, 16384, 0, 0, 0) = -1 ECONNRESET (Connection reset by peer)
That is, psycopg2/libpq sees no error when sending the first query
after the connection is closed, but gets an error reading the result.
In that case, everything worked fine.
But sometimes, the error manifests like this:
sendto(3, "Q\0\0\0\34select pg_backend_pid()\0", 29, MSG_NOSIGNAL, NULL, 0) = -1 EPIPE (Broken pipe)
recvfrom(3, "E\0\0\0mSFATAL\0C57P01\0Mterminating "..., 16384, 0, NULL, NULL) = 110
recvfrom(3, "", 16274, 0, NULL, NULL) = 0
recvfrom(3, "", 16274, 0, NULL, NULL) = 0
i.e. libpq received an error when sending the query. This manifests as
a slightly different exception from a slightly different place. More
importantly, in this case connection.closed is left at 0 rather than
being set to 2, and that is the bug I'm fixing here.
Note that we see almost identical behaviour for sync and async
connections, and the fixes are the same. So I added extremely similar
test cases.
Finally, there is still a bug here: for async connections, we
sometimes raise DatabaseError (incorrect) and sometimes raise
OperationalError (correct). Will fix that next.
2017-03-14 12:08:03 +00:00
Daniele Varrazzo
3c124a0b87
Flake8 complaints
2017-03-14 12:06:46 +00:00
Daniele Varrazzo
a5382d7b72
Skip the tests according to the earliest of libpq built/linked.
2017-03-02 19:32:44 +00:00
Daniele Varrazzo
3a441467c0
Merge branch 'no-unittest2'
...
Close #516
2017-03-02 12:41:33 +00:00
Daniele Varrazzo
5a65ff5cf4
Don't try to use unittest2
...
Modules importing unittest directly would miss the monkeypatch: see
ticket #516 .
2017-03-01 20:44:04 +00:00
Daniele Varrazzo
44d8edfd8c
Ignore None arguments passed to make_dsn()
...
Close #517 .
2017-03-01 20:12:13 +00:00
Daniele Varrazzo
3638d349ba
Skip test on PG version with bad interval rounding
...
On these ancient versions:
=# select '999999:00:00.1'::interval;
interval
--------------------------------
41666 days 15:00:00.0999999046
2017-03-01 02:14:35 +00:00
Daniele Varrazzo
691df4952b
Handle overflow in interval parsing
2017-02-24 13:23:56 +00:00
Daniele Varrazzo
834e9996da
Parse interval only using integers
...
(almost... except for micros rounding)
While this is probably an improvement on the previous implementation,
I am largely waving a dead chicken at windows, which keeps failing to
pass the seconds overflow test. If it doesn't pass now either I'll start
blaming Python's timedelta.
2017-02-24 03:48:41 +01:00
Daniele Varrazzo
a15dfbbd4f
Try to fix the same problem in windows
...
Previous commit doesn't pass on Windows: it looks like window's floor()
has an integer overflow.
2017-02-24 02:41:34 +01:00
Daniele Varrazzo
14fe3ad8c9
Fixed integer overflow in interval typecaster
...
Close #512 .
2017-02-24 02:10:27 +01: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
3e12522bc9
Don't convert '{}'::unknown into an empty list
...
Close #506 .
2017-02-08 08:43:53 +00:00
Daniele Varrazzo
791befca18
Use pydll to poke into extension library
...
Causes an error in Py 3.6 in debug mode.
Close #505
2017-02-07 12:29:06 +00:00
Daniele Varrazzo
28c489f17e
Merge branch 'no-set-default-session'
2017-02-07 00:58:54 +00:00
Daniele Varrazzo
7b11b95908
Skipped a couple of tests failing on old dbs
...
I don't even know why - worth investigating.
2017-02-06 21:40:05 +00:00
Daniele Varrazzo
7f593d5eb0
Skip tests with server not supporting NULL in array
2017-02-06 21:40:05 +00:00
Daniele Varrazzo
2e18b42db0
Don't test with server not implementing INSERT with VALUES list
2017-02-06 21:40:05 +00:00
Daniele Varrazzo
3873c6c09f
Deal consistently with E'' quotes in tests
2017-02-06 21:40:05 +00:00
Daniele Varrazzo
d23fe42873
Work around a race condition in async cancel test
2017-02-06 21:40:05 +00:00
Daniele Varrazzo
e599da6308
assertDsnEqual moved as TestSuite method
2017-02-06 21:40:05 +00:00
Daniele Varrazzo
9f467231d9
Merge branch 'conform-subclass-adapter'
2017-02-05 12:13:52 +01:00
Daniele Varrazzo
c6af16c3ae
Slower timeout for a test that sometimes fail
...
At least it should fail with an error after 2 seconds, not waiting for
Travis timeout of 10 minutes.
2017-02-05 12:06:55 +01:00
Daniele Varrazzo
3fbff5d848
Give precedence to '__conform__()' over superclasses choosing adapter
...
Close #456
2017-02-05 11:54:50 +01: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
de8b335d80
Merge branch 'master' into sql-compose
2017-02-03 04:56:02 +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
8baf6aa372
Convert warnings into errors on test
2017-02-03 04:41:32 +00:00
Daniele Varrazzo
6e89db020c
Merge branch 'fast-executemany'
2017-02-03 04:40:34 +00:00
Daniele Varrazzo
dc1b4fff90
Avoid an useless encode/decode roundtrip in execute_values()
...
Tests moved into a separate module.
2017-02-02 17:29:17 +00:00
Daniele Varrazzo
d8b1fbd905
Further skipping of slow tests
2017-02-02 03:02:29 +00:00
Daniele Varrazzo
626e57acda
Merge branch 'fast-executemany'
2017-02-02 02:40:28 +00:00
Daniele Varrazzo
88a21689ce
Added note about finding slow tests
2017-02-02 02:09:59 +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
9bac37baf7
Fixed execute_values with unicode
...
Also added unicode tests.
2017-02-01 02:47:59 +00:00
Daniele Varrazzo
2e2dcd536b
Fixed fast execute functions with Python 3
2017-02-01 02:36:54 +00:00
Daniele Varrazzo
a95fd3df1a
Added execute_batch and execute_values functions
2017-02-01 01:59:47 +00:00
Daniele Varrazzo
a8a3a298f8
Autonumbered args not available in Python 2.6
2017-01-03 17:53:02 +01:00
Daniele Varrazzo
71a168797c
Several improvements to the sql objects
...
Comparable, iterable, content accessible
2017-01-03 17:27:01 +01:00
Daniele Varrazzo
a76e665567
Use {} instead of %s placeholders in SQL composition
2017-01-03 15:02:34 +01:00
Daniele Varrazzo
cf40bff2e2
Dropped sql.compose
...
Use a SQL % operator instead.
2017-01-01 08:39:02 +01:00
Daniele Varrazzo
4a55b8018a
Adding sql module documentation
2017-01-01 08:12:05 +01:00
Daniele Varrazzo
41b9bfe401
Added test for sql percents treatment
2017-01-01 06:37:09 +01:00
Daniele Varrazzo
828415d476
Typo: composible -> composable
2017-01-01 06:32:18 +01:00
Daniele Varrazzo
ad2643266f
Fixed sql.compose with no args and added tests
2017-01-01 06:26:54 +01:00
Daniele Varrazzo
8c020ca47a
Fixed sql.Composed representation
2017-01-01 06:26:42 +01:00
Daniele Varrazzo
600416aafc
Fixed sql stuff in Py3
2017-01-01 05:59:21 +01:00
Daniele Varrazzo
f11e6d82b0
Added basic sql module implementation
2017-01-01 05:23:15 +01:00
Daniele Varrazzo
fad5100079
Adding some boilerplate for the new module
2017-01-01 03:53:08 +01:00
Daniele Varrazzo
faaef61c27
Merge branch 'master' into named-callproc
2016-12-26 01:49:42 +01:00
Daniele Varrazzo
c22093ddd4
Skip replication tests in green mode
2016-12-25 19:00:30 +01:00
Daniele Varrazzo
b73115ac41
Added test to verify bug #482
2016-12-25 18:30:27 +01:00
Daniele Varrazzo
a478ba9a47
Fixed tests failing on Python 2.6
2016-12-24 01:03:57 +01:00
Daniele Varrazzo
643ba70bad
Added ipaddress objects conversion
...
Close #387
2016-10-11 04:54:41 +01:00
Daniele Varrazzo
706ad2f177
Conver network array types into array of strings by default
2016-10-11 02:31:45 +01:00
Daniele Varrazzo
05627ac0f9
Fix unicode mogrify test on python 2
2016-10-11 00:22:23 +01:00
Daniele Varrazzo
91d2158de7
Python source cleanup using flake8
2016-10-11 00:11:55 +01:00
Daniele Varrazzo
78649f8e90
Dropped use of b() "macro" and 2to3 fixer
...
Just use the b"" strings syntax supported from python 2.6.
2016-08-15 01:56:36 +01:00
Daniele Varrazzo
1d950748af
Merge branch 'replication-protocol'
2016-08-14 21:09:54 +01:00
Daniele Varrazzo
bd95269c69
Merge branch 'master' into nul-terminator
2016-08-07 02:49:13 +01:00
Jonathan Ross Rogers
cde19c4d59
Make Range pickleable
2016-08-07 02:38:52 +01:00
Daniele Varrazzo
2a4d6027a4
Merge branch 'master' into replication-protocol
...
Conflicts:
tests/testconfig.py
2016-08-07 01:53:21 +01:00
Alexander Schrijver
03824a1dba
Throw an exception when a NUL character is used as a parameter.
2016-07-18 22:56:55 +02:00
Daniele Varrazzo
7566af145b
Merge branch 'conn-get-parameters'
2016-07-01 20:12:01 +01:00
Daniele Varrazzo
5bcaf11f9d
Allow adapting bytes using QuotedString on Python 3 too
...
Close #365 .
2016-07-01 19:14:00 +01:00
Daniele Varrazzo
70af49c0a2
Fixed encoding tests on Py3
2016-07-01 18:50:24 +01:00
Daniele Varrazzo
4a450b63c4
Don't hope to encode stuff in an arbitrary encoding
...
libpq's PQescapeString will use the same encoding it has seen before in
a connection (static_client_encoding).
So I think I'll leave this feature here for people who know what is
doing, but won't really document it as a feature: it can't really work
in a generic way (unless adding some disgusting hack like creating a
fake connection with the encoding we want to call PQescapeStringConn
instead of PQescapeString).
2016-07-01 18:02:20 +01:00
Daniele Varrazzo
2e8e61b8d4
Test moved to the right module, cleanup, but same problem
2016-07-01 18:01:16 +01:00
Daniele Varrazzo
bada1f1f8e
Work in progress on writable encoding
...
Would help using adapt(unicode) to quote strings without a connection,
see ticket #331 .
Currently in heisenbug state: if test_connection_wins_anyway and
test_encoding_default run (in this order), the latter fail because the
returned value is "'\xe8 '", with an extra space. Skipping the first
test, the second succeed.
The bad value is returned by the libpq:
ql = PQescapeString(to+eq+1, from, len);
just returns len = 2 and an extra space in the string... meh.
2016-07-01 18:00:05 +01:00
Greg Ward
3ed2c54790
Fix scattered grammar/spelling errors in comments, debug output, etc.
2016-06-30 21:09:15 +01:00
Daniele Varrazzo
eb687103b4
Skip null array test on Postgres versions not supporting it
2016-03-10 12:04:41 +00:00
Oleksandr Shulgin
a7887fab07
Merge remote-tracking branch 'zalando/feature/replication-protocol' into feature/replication-protocol-c-connection-object
2016-03-08 18:56:58 +01:00
Oleksandr Shulgin
da6e061ee8
Use python-defined make_dsn() for ReplicationConnection class
2016-03-08 18:52:21 +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
Daniele Varrazzo
2c55a1bd53
Verify that the dsn is not manipulated by make_dsn if not necessary
2016-03-03 15:07:38 +00:00
Daniele Varrazzo
1c4523f0ac
Implementation of make_dsn in Python
...
This is equivalent to what proposed in #363 , but with a much simpler
implementation.
2016-03-03 04:33:59 +00:00
Oleksandr Shulgin
5d33b39829
Fix error test for invalid START_REPLICATION command.
2016-01-21 15:56:27 +01:00
Oleksandr Shulgin
09a4bb70a1
Allow retrying start_replication after syntax or data error.
2016-01-05 12:31:57 +01:00
Daniele Varrazzo
5fd0f6c4ee
Fixed race condition on import in errorcodes.lookup
...
Fixes #382 .
2015-12-16 12:03:10 +00:00
Daniele Varrazzo
7302f348bc
Added test with objects without length as callproc param
2015-12-12 17:51:08 -05:00
Daniele Varrazzo
d297976d6d
Raise TypeError if the dict in callproc param contains non-strings
...
Check-and-conversion chain fixed and simplified. 'spname' was a
reference leak.
2015-12-12 17:51:08 -05:00
mrmilosz
c205f140a0
callproc: tests, docs, and comment/error-reporting touchups.
2015-12-12 17:49:59 -05: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
fbcf99ad07
Move replication connection to C level.
2015-10-27 18:21:24 +01:00
Oleksandr Shulgin
433fb957cb
Merge branch 'feature/connect2' into feature/replication-protocol
2015-10-27 17:37:18 +01:00
Oleksandr Shulgin
7aba8b3ed0
Rework psycopg2.connect() interface.
2015-10-27 17:35:57 +01:00
Oleksandr Shulgin
8b79bf43ac
Drop ReplicationCursor.flush_feedback(), rectify pq_*_replication_*() interface.
2015-10-23 18:30:18 +02:00
Oleksandr Shulgin
22cbfb26d6
Actually add replication tests to the test suite.
2015-10-20 13:05:43 +02:00
Oleksandr Shulgin
0bb81fc848
Properly subclass ReplicationCursor on C level.
2015-10-19 20:00:39 +02:00
Oleksandr Shulgin
7aea2cef6e
Improve async replication test.
2015-10-19 17:02:18 +02:00
Oleksandr Shulgin
4ab7cf0157
Replace stop_replication with requirement for an exception.
2015-10-19 15:42:42 +02:00
Oleksandr Shulgin
0435320f34
Fix PSYCOPG2_TEST_REPL_DSN handling.
2015-10-16 16:36:03 +02: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
8e518d4954
Merge branch 'master' into feature/replication-protocol
2015-10-15 12:27:43 +02:00
Oleksandr Shulgin
89bb6b0711
Proper unicode handling in quote_ident.
2015-10-15 11:52:18 +02:00
Oleksandr Shulgin
9295bce154
Add psycopg2.extensions.quote_ident.
2015-10-14 17:00:25 +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