Daniele Varrazzo
8a2deb39ed
Escape table and column names in cursor.copy_from() and .copy_to()
2021-05-25 11:50:23 +01:00
Hugo van Kemenade
c3b65d63b6
Upgrade f-strings with flynt -a and remove int()
2020-11-18 18:09:08 +02:00
Hugo van Kemenade
8d7f660309
Upgrade f-strings with flynt
2020-11-17 23:52:11 +02:00
Hugo van Kemenade
7babeccbec
Upgrade Python syntax with pyupgrade --py36-plus
2020-11-17 22:22:11 +02:00
Hugo van Kemenade
6c48b63ae4
Drop support for EOL Python 2.7
2020-11-17 22:22:11 +02:00
Daniele Varrazzo
dec28a21ac
'cursor.query' reports the query of the last COPY opearation too
...
Close #1141 .
2020-09-05 21:47:35 +01:00
Daniele Varrazzo
6eb4fab1db
Added reason for skipping on CockroachDB
2020-07-27 23:03:26 +01:00
Daniele Varrazzo
7e1e801899
Skip copy tests on CockroachDB
2020-07-21 22:22:55 +01:00
Daniele Varrazzo
5e0b02afb2
Copyright bumped to 2020
2020-01-17 21:21:11 +00:00
Daniele Varrazzo
dfb301b42b
Use PY2, PY3 for conditional code instead of sys.version_info
2019-03-16 19:54:40 +00:00
Daniele Varrazzo
b0119fef81
Other import moved to top level in tests
2019-03-16 19:13:58 +00:00
Daniele Varrazzo
aaba4dcf87
TextIOBase moved to tests compat imports
2019-03-16 18:41:59 +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
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
05f9e231a0
Full flake8 3.5 cleanup
2018-10-23 00:39:14 +01: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
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
Daniele Varrazzo
06396e5162
Merge remote-tracking branch 'jdufresne/import-unittest'
2017-12-02 12:10:26 +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
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
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
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
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
91d2158de7
Python source cleanup using flake8
2016-10-11 00:11:55 +01:00
Daniele Varrazzo
7ce7fef322
Propagate read error messages in COPY FROM
...
Fix ticket #270 .
2015-02-08 01:42:21 +00:00
Daniele Varrazzo
56adc590ff
Fixed segfault if COPY statements are executed
...
Close ticket #219
2014-06-06 21:42:21 +02:00
Daniele Varrazzo
35545e7374
Skip rowcount on copy test on postgres < 8.2
...
It looks like the server doesn't send the message.
2014-05-13 14:34:09 +01:00
Daniele Varrazzo
81b5f1fb26
Copy operations correctly set the cursor.rowcount attribute
...
Fixes ticket #180 .
2014-05-05 23:53:50 +01:00
Daniele Varrazzo
c796bc2cbd
Added test to verify copysize handling in copy_expert
...
Not an original psycopg2 bug but present in pure python implementation,
e.g. ctypes issue #25 and cffi issue #5 .
https://github.com/mvantellingen/psycopg2-ctypes/issues/25
https://github.com/chtd/psycopg2cffi/pull/5
2013-05-06 10:48:10 +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
294e7ae080
Tests tweaked to run on all the supported versions
2013-03-18 10:06:07 +00:00
Daniele Varrazzo
8fb08efae7
Allocate dynamically memory for the list of columns in COPY
...
Some bloke finds the limit of 8K too restrictive... ticket #68 .
2011-09-12 02:21:59 +01:00
Daniele Varrazzo
679af4a975
Fixed copyfile refcount in copy_expert
...
In case of early error, jumping to exit would have decref'd the borrowed
reference to file.
Issue spotted by Dave Malcolm, thanks!
2011-06-07 01:20:25 +01:00
Daniele Varrazzo
75c61c2e80
Added complete roundtrip test with copy_expert and Unicode
2011-02-19 14:35:56 +00:00
Daniele Varrazzo
b544354db2
COPY sends unicode to a file if it derives from io.TextIoBase
...
Fixes ticket #36 .
2011-02-05 15:12:37 +01:00
Daniele Varrazzo
79048ff19a
Merge branch 'python2' into python3
...
Conflicts:
NEWS-2.3
tests/__init__.py
tests/test_lobject.py
tests/test_quote.py
tests/testutils.py
2011-01-10 00:46:02 +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
ab5934dc35
Use ascii_letters instead of letters.
...
The latter is locale-dependent and not available on Py3.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
ade1b2cc7b
Test suite converted into a proper package.
...
Dropped cyclic import from modules to tests: they were only working
because a second copy of the package was found in the project dir.
Use relative import so that 2to3 can do a good conversion.
2010-12-21 05:02:19 +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
deb2d9050f
Exceptions raised by the columns iterator propagated.
2010-07-10 00:12:50 +01:00
Daniele Varrazzo
cb8128c6d4
Added test to verify copy_from() with columns.
2010-07-10 00:04:54 +01:00
Daniele Varrazzo
b114e25c31
Added some COPY tests.
2010-04-07 23:41:32 +01:00