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
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
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
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
d8b1fbd905
Further skipping of slow tests
2017-02-02 03:02:29 +00:00
Daniele Varrazzo
a478ba9a47
Fixed tests failing on Python 2.6
2016-12-24 01:03:57 +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
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
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
7aba8b3ed0
Rework psycopg2.connect() interface.
2015-10-27 17:35:57 +01:00
Oleksandr Shulgin
ffd98a82c0
Add test for libpq_version
2015-06-02 11:12:16 +02:00
Daniele Varrazzo
ea54aa77ed
Added test to verify _psycopg can be imported
2014-08-28 02:17:49 +01:00
Daniele Varrazzo
345077d5f7
Fixed pickling of exceptions with no pgerror/pgcode set
...
Fixes ticket #170 .
2013-07-19 16:05:59 +01: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
73949cd1b8
Merge branch 'diagnostics' into devel
2013-03-20 01:47:14 +00:00
Daniele Varrazzo
114c62fac8
Added tests to verify the new Diagnostics properties
...
diag can be used on exceptions raised without cursor and is independent from
the cursor.
Docs updated to reflect the changes.
2013-03-20 00:03:58 +00:00
Daniele Varrazzo
294e7ae080
Tests tweaked to run on all the supported versions
2013-03-18 10:06:07 +00:00
Daniele Varrazzo
70b756b8c7
Added test to verify Diagnostics works after copy errors
2013-03-18 00:31:25 +00:00
Daniele Varrazzo
660386929f
Added test to verify Diagnostics reference disposal
2013-03-18 00:24:46 +00:00
Daniele Varrazzo
42b063b562
Added all supported properties to the Diagnostic object
2013-03-17 23:58:10 +00:00
Matthew Woodcraft
c75a3bbab4
Work-in-progress support for retrieving PG_DIAG result error fields.
2013-03-17 16:41:15 +00:00
Daniele Varrazzo
20d3d0f66d
Raise TypeError instead of InterfaceError on bad params on connect()
...
TypeError is the standard Python error raised in this case:
$ python -c "(lambda a: None)(b=10)"
TypeError: <lambda>() got an unexpected keyword argument 'b'
We only used to raise InterfaceError when connect was used without
any parameter at all, so it's hard to think a program depending on
that design. Furthermore the function has always raised (and still
does) OperationalError too, if the bad argument is detected by the
libpq, and that cannot be changed because we can't tell the
difference from a normal connection error.
2012-09-26 11:55:21 +01:00
Daniele Varrazzo
cd316a94f1
Dropped quirks in connection arguments handling
...
Now connect() raises an exception instead of swallowing keyword arguments
when a connection string is specified as well
Closes ticket #131 .
2012-09-25 23:46:46 +01:00
Daniele Varrazzo
98d6d96ee3
Fixed exception testing on Python 3
...
...and so caught exceptions are local to the except suite in Py3.
(Lo sapevate? Sapevatelo!)
2012-02-23 23:15:42 +00:00
Daniele Varrazzo
43daba38e7
Make Error and subclasses picklable
...
Useful for multiprocessing interaction.
Closes ticket #90 .
2012-01-14 17:34:09 +00:00
Daniele Varrazzo
417203f68e
Added test to check connect() with no parameters
2011-11-17 21:51:24 +00:00
Daniele Varrazzo
625cc1b402
Escape parameters to the connection strings as required by PQconnectdb
2011-11-17 21:51:24 +00:00
Daniele Varrazzo
99ac79511c
Added test module to verify the dsn manipulation
2011-11-17 21:51:24 +00:00