summaryrefslogtreecommitdiff
path: root/tests/test_transaction.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.
* Use modern except syntax throughout projectJon Dufresne2017-11-201-4/+4
| | | | | | The syntax "except Exception, exc:" is deprecated. All Python versions supported by psycopg2 support the newer, modern syntax. Forward compatible with future Python versions.
* Allow skipping the slow testmanylinuxDaniele Varrazzo2017-02-021-1/+3
| | | | | | | | 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.
* Python source cleanup using flake8Daniele Varrazzo2016-10-111-2/+5
|
* Testing boilerplate unified in a single base classDaniele Varrazzo2013-04-071-16/+11
| | | | | The class makes a connection always available, allows creating new connection and closes everything on tear down.
* Cleanup of skipping of testing methods on certain Py/PG versionsDaniele Varrazzo2011-02-151-2/+2
|
* Merge branch 'python2' into python3Daniele Varrazzo2011-01-101-0/+23
|\ | | | | | | | | | | | | | | | | Conflicts: NEWS-2.3 tests/__init__.py tests/test_lobject.py tests/test_quote.py tests/testutils.py
| * Added license to unit testsDaniele Varrazzo2011-01-091-0/+23
| | | | | | | | As the test suite is now part of the source distribution.
* | Test suite converted into a proper package.Daniele Varrazzo2010-12-211-5/+4
|/ | | | | | 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.
* More careful connections handling during tests.Daniele Varrazzo2010-11-281-0/+3
|
* Deal uniformly with test servers without pg_sleep.Daniele Varrazzo2010-11-281-6/+4
|
* Test cleanup.Daniele Varrazzo2010-11-191-3/+6
| | | | | | Tests pass or fail gracefully on older PostgreSQL versions. If unittest2 is available, skip tests instead of printing warnings.
* Applied spelling fixes patch from Peter EisentrautFederico Di Gregorio2010-07-181-2/+2
|
* Changes license to LGPL3 + OpenSSL exception on all source filesFederico Di Gregorio2010-02-121-0/+2
|
* 2008-04-21 Jorgen Austvik <Jorgen.Austvik@sun.com>James Henstridge2008-04-201-3/+3
| | | | | | | * tests/*.py: use the DSN constructed in tests/__init__.py. * tests/__init__.py: allow setting the host, port and user for the DSN used by the tests through the environment.
* * tests/test_connection.py (ConnectionTests): add simple tests forJames Henstridge2008-01-191-8/+4
| | | | | | | | the Connection and Cursor "closed" attributes. * psycopg/cursor_type.c (psyco_curs_get_closed): add a "closed" attribute to cursors. It will be True if either the cursor or its associated connection are closed. This fixes bug #164.
* * tests/test_transaction.py (DeadlockSerializationTestCase): portJames Henstridge2008-01-161-1/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | over some tests for serialisation and deadlock errors, demonstrating that TransactionRollbackError is generated. (QueryCancelationTests): add a test to show that QueryCanceledError is raised on statement timeouts. * psycopg2da/adapter.py (_handle_psycopg_exception): rather than checking exception messages, check for TransactionRollbackError. * psycopg/pqpath.c (exception_from_sqlstate): return TransactionRollbackError for 40xxx errors, and QueryCanceledError for 57014 errors. (pq_raise): If we are using an old server, use TransactionRollbackError if the error message contains "could not serialize" or "deadlock detected". * psycopg/psycopgmodule.c (_psyco_connect_fill_exc): remove function, since we no longer need to store pointers to the exceptions in the connection. This also fixes a reference leak. (psyco_connect): remove _psyco_connect_fill_exc() function call. * psycopg/connection.h (connectionObject): remove exception members from struct. * psycopg/connection_type.c (connectionObject_getsets): modify the exception attributes on the connection object from members to getsets. This reduces the size of the struct. * lib/extensions.py: import the two new extensions. * psycopg/psycopgmodule.c (exctable): add new QueryCanceledError and TransactionRollbackError exceptions.
* * tests/test_transaction.pyJames Henstridge2008-01-111-1/+1
| | | | | | | | | | | | | (TransactionTestCase.test_failed_commit): Expect IntegrityError instead of OperationalError. * psycopg/pqpath.c (exception_from_sqlstate): new function that converts an SQLSTATE error code to the corresponding exception class. (pq_raise): use exception_from_sqlstate() to pick which exception to use when working with protocol version 3. (pq_complete_error): Let pq_raise() pick an appropriate exception rather than forcing OperationalError.
* Added 'make check' target, running all the available tests.Daniele Varrazzo2007-11-111-0/+1
| | | | | | Most of the updates have been provided by James Henstridge. Closes ticket #195.
* Fixed bug #194 (and added nice MD project not that C/C++ is supported.)Federico Di Gregorio2007-09-081-0/+76