Commit Graph

49 Commits

Author SHA1 Message Date
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
Daniele Varrazzo
c3ee9cac41 Dropped unused test functions 2017-11-28 16:11:06 +00:00
Hugo
53c1c5dcc1 Remove redundant hasattr checks 2017-11-28 16:03:23 +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
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
Daniele Varrazzo
a5382d7b72 Skip the tests according to the earliest of libpq built/linked. 2017-03-02 19:32:44 +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
3873c6c09f Deal consistently with E'' quotes in tests 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
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
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
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
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
Greg Ward
3ed2c54790 Fix scattered grammar/spelling errors in comments, debug output, etc. 2016-06-30 21:09:15 +01:00
Oleksandr Shulgin
fbcf99ad07 Move replication connection to C level. 2015-10-27 18:21:24 +01:00
Oleksandr Shulgin
cf4f2411bf Fix async replication and test. 2015-10-15 18:01:43 +02:00
Daniele Varrazzo
6803341f21 Report NotSupportedError for PGRES_COPY_BOTH and PGRES_SINGLE_TUPLE
Fixes #352.
2015-09-30 12:28:07 +01:00
Oleksandr Shulgin
4bb6f9cef2 Add libpq version discovery 2015-06-01 18:05:11 +02:00
Hyunjun Kim
4eee1207f9 Fix several typos 2015-05-03 10:30:21 +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
Chris Withers
e60266c4c5 New implementation of Range sorting that works for Python 2.5 to 3.3, at least. 2014-02-18 20:55:00 +00:00
Daniele Varrazzo
a44db81d9b Skip tests on python implementations without getrefcount()
PyPy is one of these.
2013-05-06 10:39:24 +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
546927d44a Use wrap to fix names of decorated test methods
Decorators not using wrap() prevent running the test from command line, e.g.
with:

    python tests/__init__.py test_module.TestSuite.test_method
2013-03-20 23:53:20 +00:00
Daniele Varrazzo
294e7ae080 Tests tweaked to run on all the supported versions 2013-03-18 10:06:07 +00:00
Daniele Varrazzo
66d6c68dcc Properly cleanup memory of broken connections
Fixed ticket #148.
2013-03-16 11:56:38 +00:00
Daniele Varrazzo
66c543b16c Parse bytea output format ourselves instead of using the libpq
PG 9.0 uses the hex format by default, and clients < 9.0 can't parse that
format, requiring client update and great care in what is linked at runtime,
and generally giving headache to users and transitively us.
2011-03-26 12:59:14 +00:00
Daniele Varrazzo
894d3f653c Raise an exception if the libpq fails to decode bytea in hex format 2011-02-23 14:04:27 +00:00
Daniele Varrazzo
c620f18be1 Provide cursor.description as named tuple if possible
If namedtuple() is not available, use regular tuples.
2011-02-19 00:05:43 +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
e3095edad3 Python 3 conversion failure on Windows
Windows is not able to create a tempfile with NamedTemporaryFile and then
open it with a second file handle without closing the first one.  Added
code to close the handle, and keep the file around a little longer so it
can be reopened and rewritten to again.
2011-02-11 17:40:23 -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
Daniele Varrazzo
ca3d9da83b Skip GC bug test if uuid is not available 2011-01-18 02:09:49 +00:00
Daniele Varrazzo
8e1257d7d0 Fixed check for pg_sleep availability in tests
The function is available since PG 8.2.
2011-01-18 00:57:27 +00: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
598b9424d2 Deal uniformly with test servers without pg_sleep. 2010-11-28 17:29:36 +00:00
Daniele Varrazzo
ed3b2188fe Fixed import of test functions from Python 2.7 unittest. 2010-11-19 18:01:29 +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