Jon Dufresne
afbbdd18b6
Remove unused variable
...
The variable i is immediately overwritten by the next line.
2019-03-13 11:13:24 +00:00
Jon Dufresne
03bb44dd2c
Convert while 1:
statements to while True:
...
A slightly more readable and modern syntax.
2019-03-13 11:13:05 +00:00
Jon Dufresne
18f5d5ad05
Remove unused imports from tests/test_ipaddress.py
2019-03-13 11:12:48 +00:00
Daniele Varrazzo
a68df50c7b
Added ConnectionInfo.dsn_parameters attribute
2019-02-17 02:37:09 +00:00
Daniele Varrazzo
599432552a
Copyright year updated
...
ag -l Copyright | xargs sed -i \
"s/\(.*copyright (C) [0-9]\+\)\(-[0-9]\+\)\?\(.*\)/\1-$(date +%Y)\3/I"
2019-02-17 01:36:36 +00:00
Daniele Varrazzo
d08be18671
Merge branch 'libpq-ptrs'
2019-02-17 00:17:43 +01:00
Daniele Varrazzo
6bbfce7b89
Skip password encryption test if libpq < 10
2019-02-16 22:57:16 +01:00
Daniele Varrazzo
3b7c083c3d
Skip tests involving ctypes on Windows
...
No idea about how to import libpq.
2019-02-16 18:12:52 +01:00
Daniele Varrazzo
7c7bbb9742
Added connection.pgconn_ptr and cursor.pgresult_ptr
...
Allow interacting with libpq in Python via ctypes.
See #782 .
2019-02-16 18:12:52 +01:00
Daniele Varrazzo
3de4d17519
Fixed use of StandardError in test
...
In Py3 it's gone.
2019-02-11 00:26:01 +00:00
Daniele Varrazzo
30c1befa64
SQLSTATE error classes implemented in C
...
The module is only used to export them to Python.
2019-02-10 03:45:14 +00:00
Daniele Varrazzo
35ec7ad9c1
Use a proper LRU cache for namedtuples
...
Previous one didn't refresh by last use. Use the stdlib version for py3
and one of our own for py2.
Max size set to 512, which should be fine for everyone (tweaking is
still possible by monkeypatching, as the tests do, but I don't want to
make an interface of it).
2019-02-02 19:29:20 +00:00
Daniele Varrazzo
805527fcd6
Added caching of types generated by NamedTupleCursor
...
see #838
2019-02-02 14:22:25 +00:00
Daniele Varrazzo
ddbe495d70
Added BYTESARRAY typecaster
2019-01-18 15:47:01 +00:00
Daniele Varrazzo
4ab4247189
Added test for BYTES typecaster
2019-01-18 15:10:17 +00:00
Daniele Varrazzo
f3695e36c7
Merge remote-tracking branch 'eternalflow/execute-values-returning-clause-support'
2018-12-27 14:53:12 +01:00
Jon Dufresne
eb2d1766c6
Remove unnecessary test decorator 'skip_if_cant_cast'
...
ctypes is available and works on all supported Pythons. It has been
available since Python 2.5. The tests were written when Python 2.4 was
still supported.
2018-12-04 18:20:17 -08:00
Daniele Varrazzo
68bacbb194
Merge pull request #822 from jdufresne/decorate-all
...
Simplify 'decorate_all_tests' usage by decorating the test class
2018-12-04 14:22:02 +00:00
Jon Dufresne
a739c09f67
Simplify 'decorate_all_tests' usage by decorating the test class
...
Skip tests as early as possible by decorating the whole class with
unittest.skipIf instead of every test method individually.
2018-12-01 19:40:27 -08:00
Jon Dufresne
17dc5a85a3
Remove workarounds for unsupported libpq < 9.1
...
Per http://initd.org/psycopg/docs/install.html#prerequisites :
> PostgreSQL client library version from 9.1
2018-12-01 08:58:39 -08:00
Ivan Kotelnikov
b40ac15efc
rename param name to fetch
2018-11-24 20:51:18 +02:00
Ivan Kotelnikov
e2b99d3a8e
write test for fetch_result flag
2018-11-22 12:30:37 +02:00
Daniele Varrazzo
73a680f45d
Convert int subclasses to long before adapting
...
Fixes adaptation of int/long subclasses whose str() is not the number,
such IntEnum
Close #591
Note that I thought it would have needed a new adapter, so I considered
it a new feature. But it is more a shortcoming of the int adapter
failing to do something reasonable (poor Liskov, always mistreated) so I
may actually backport it if there is a new 2.7 release.
2018-11-16 18:16:03 +00:00
Federico Di Gregorio
01f8475f53
Merge branch 'master' into feature-expose-pgconn
2018-11-07 14:15:29 +01:00
Daniele Varrazzo
a83696fc50
Fixed adaptation of lists of empty lists
...
...somehow. Postgres doesn't support them and converts them into a
simple empty array. However this is not really our concern: the syntax
we return is valid.
Close #788
2018-10-30 01:48:51 +00:00
Daniele Varrazzo
2f24a2e22d
Use class decorators to decorate all tests
...
Test decorators changed so that they can be applied either to a method
or to a class. Of course their double nature is implemented by a
decorator.
2018-10-30 00:23:56 +00:00
Daniele Varrazzo
8fb0f694f7
Don't barf on Composite passed to execute_values()
...
Close #794
2018-10-23 01:57:48 +01:00
Daniele Varrazzo
05f9e231a0
Full flake8 3.5 cleanup
2018-10-23 00:39:14 +01:00
Daniele Varrazzo
0236c68da9
Merge branch 'connection-info'
2018-10-15 01:24:00 +01:00
Daniele Varrazzo
b205764fdd
Merge branch 'master' into errors-module
2018-10-15 00:58:32 +01:00
Daniele Varrazzo
e7227ce87b
Added errors.lookup() function
2018-10-15 00:56:51 +01:00
Daniele Varrazzo
44bd2927c5
Use the connection.info properties instead of the legacy methods
2018-10-13 03:28:42 +01:00
Daniele Varrazzo
704e6797e7
Guard from some info functions not available in some libpq versions
2018-10-13 03:09:39 +01:00
Daniele Varrazzo
d138e42ee5
Added ConnectionInfo.parameter_status()
2018-10-13 02:40:17 +01:00
Daniele Varrazzo
9f6a3a5e96
Added ConnectionInfo.ssl_attribute()
2018-10-13 02:21:38 +01:00
Daniele Varrazzo
cb3d5f9d92
Added all the missing ConnectionInfo attributes
2018-10-13 01:36:07 +01:00
Daniele Varrazzo
439dff974d
Added ConnectionInfo.error_message
2018-10-13 00:47:04 +01:00
Daniele Varrazzo
d29aa1c437
Fixed refcount in connection's readonly and deferrable getters
...
Close #790
2018-10-12 23:32:13 +01:00
Daniele Varrazzo
1ac6359fef
Added other members to the ConnectionInfo class
...
Starting deprecating softly some of the methods bloating the connection
class.
2018-10-12 04:18:59 +01:00
Daniele Varrazzo
0a04c8892d
Added several ConnectionInfo attributes
2018-10-12 04:18:59 +01:00
Daniele Varrazzo
0e2b516a3c
Moving host attribute to a connection.info object
2018-10-11 22:42:52 +01:00
Daniele Varrazzo
f99a8de6d0
Added table_oid, table_column on cursor.description items
...
Close #661
2018-10-11 03:37:09 +01:00
Daniele Varrazzo
c314512115
Fixed infinite loop in pq_get_last_result after COPY
...
There will be an error downstream but we have to get out of this
function first.
Close #781
2018-10-10 23:57:34 +01:00
Daniele Varrazzo
9148157697
Merge branch 'master' into https
2018-10-10 22:07:33 +01:00
Daniele Varrazzo
cd9d74c462
Merge branch 'conn-get-host'
2018-10-10 22:03:36 +01:00
Daniele Varrazzo
f5f6b420b2
Merge remote-tracking branch 'origin/diag-schema-name-nonloc'
2018-10-10 21:46:51 +01:00
Federico Di Gregorio
296c80d1f2
Commented out test to avoid beaking master
2018-10-10 11:05:02 +02:00
Federico Di Gregorio
1fe9f1ac5b
Fixed test for issue #788
2018-10-10 09:35:18 +02:00
Federico Di Gregorio
ebcfbe03f9
Added test for issue #788
2018-10-10 09:14:56 +02:00
Federico Di Gregorio
81addddaee
Added connection.get_native_connection()
2018-10-07 13:54:24 +02:00
Marco De Paoli
1c553bb703
Added connection.host
...
Return the server host name of the current connect.
2018-10-06 15:19:01 +02:00
Daniele Varrazzo
4e0b2ec9c9
Added Diagnostics.severity_nonlocalized attribute
...
Close #783 .
2018-10-04 16:13:46 +01:00
Daniele Varrazzo
4aa02b7855
sql.Identifier can wrap a sequence of strings to represent qualified names
...
Close #732 .
2018-10-04 12:46:10 +01:00
Michel Albert
d317977205
Implement __str__ for range types
2018-09-30 10:15:55 +02:00
Jon Dufresne
b07e34e0b8
Prefer https:// URLs when available
2018-09-22 19:02:33 -07:00
Daniele Varrazzo
344ce15261
Better testing of encryption function with libpq < 10
2018-08-17 02:09:22 +01:00
Daniele Varrazzo
ce1ac3aea9
Read exceptions to raise from a Python module
2018-08-17 02:00:01 +01:00
Daniele Varrazzo
466efe4461
Bump tests for selective closure of named cursor to pg 8.2
...
Previous versions don't support the features as they don't have the
pg_cursors view. But they are too old to care.
2018-07-24 21:16:36 +01:00
Daniele Varrazzo
6d8f4f9f0d
Close named cursor if exist, even if we didn't run execute
...
Close #746
2018-07-24 21:16:36 +01:00
Daniele Varrazzo
0bb7d0db48
DictCursor and RealDictCursor rows maintain columns order
...
Close #177 .
2018-05-21 03:14:08 +01:00
Daniele Varrazzo
e8a831dda2
Merge branch 'master' into drop-2to3
2018-05-20 23:56:29 +01:00
Daniele Varrazzo
a0f7027ad5
Added tests to verify iter methods on dict cursors
...
ISTM the refactoring in #648 broke something
2018-05-20 23:55:18 +01:00
Daniele Varrazzo
82ae44ac3a
DictCursor/RealDictCursor tests split
2018-05-20 23:35:26 +01:00
Daniele Varrazzo
9cf658ec6e
Fixed refcount handling in encrypt_password
...
Added tests to check bad types, which discovered the above problem: on
type error we would have decref'd on exit something that was only
borrowed (because we wouldn't have performed matching increfs).
2018-05-20 21:18:36 +01:00
Daniele Varrazzo
abca14d601
Fixed keywords support for encrypt_password and tests completed
2018-05-20 20:50:04 +01:00
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
Daniele Varrazzo
0161d54dbb
Merge branch 'master' into encrypt-pass
2018-05-20 17:57:34 +01:00
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