summaryrefslogtreecommitdiff
path: root/tests/test_with.py
Commit message (Collapse)AuthorAgeFilesLines
* Use relative imports throughout testsJon Dufresne2017-12-101-1/+1
| | | | | | | | | | | | | | 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/
* Always import the system unittestJon Dufresne2017-12-011-1/+2
| | | | | | | 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.
* Remove "from __future__ import with_statement"Jon Dufresne2017-11-281-3/+0
| | | | | All versions of Python supported by psycopg2 have builtin support for the with statement. The import is unnecessary noise.
* Use modern except syntax throughout projectJon Dufresne2017-11-201-1/+1
| | | | | | The syntax "except Exception, exc:" is deprecated. All Python versions supported by psycopg2 support the newer, modern syntax. Forward compatible with future Python versions.
* Python source cleanup using flake8Daniele Varrazzo2016-10-111-3/+7
|
* More tests tweaksDaniele Varrazzo2015-02-081-0/+1
| | | | | | Named cursors on old server versions have a different prefetch behaviour. This has hidden me the supported range of the 24:00 time format. Let's have another go at full testing...
* Don't try to close the server cursor in error stateDaniele Varrazzo2014-09-161-0/+12
| | | | | | | | | `close()` is implicitly called by `__exit__()`, so an exit on error would run a query on a inerr connection, causing another exception hiding the original one. The fix is on `close()`, not on `__exit__()`, because the semantic of the latter is simply to call the former. Closes #262.
* Testing boilerplate unified in a single base classDaniele Varrazzo2013-04-071-16/+12
| | | | | The class makes a connection always available, allows creating new connection and closes everything on tear down.
* Make sure to call subclasses methods on context exitDaniele Varrazzo2012-12-031-0/+55
|
* Added support for with statement for connection and cursorDaniele Varrazzo2012-12-031-0/+157
The implementation should be conform to the DBAPI, although the "with" extension has not been released yet.