Commit Graph

20 Commits

Author SHA1 Message Date
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
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
05f9e231a0 Full flake8 3.5 cleanup 2018-10-23 00:39:14 +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
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
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
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
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
b61a2a34c4 Close the connection on error in callback
Unfortunately PQcancel blocks, so it's not better than PQgetResult.
It has been suggested to use PQreset in non-blocking way but this would give
the Python program the burden of handling a connection done but not configured
in an unexpected place.
2012-10-06 11:58:52 +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
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
31093a7a58 Some light cleanup for Py3 conversion.
Either flagged as warning by python2.6 -3 or converted by 2to3.
2010-12-21 04:02:13 +00:00
Daniele Varrazzo
361786f4a8 More careful connections handling during tests. 2010-11-28 17:29:37 +00:00
Daniele Varrazzo
9f78141532 Don't consider the kernel not blocking us on write as an error. 2010-11-25 03:13:49 +00:00
Daniele Varrazzo
7a06c0455b Try to restore the connection state after a wait callback error. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
0dd5d3f1d9 Correctly flush async queries in 'green' mode. 2010-04-21 15:21:32 +01:00