summaryrefslogtreecommitdiff
path: root/tests/test_async.py
Commit message (Collapse)AuthorAgeFilesLines
* Avoid installing tests to site-packagesJon Dufresne2017-12-101-3/+2
| | | | | | | | 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.
* Use relative imports throughout testsJon Dufresne2017-12-101-2/+2
| | | | | | | | | | | | | | 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-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.
* Added readonly and deferrable attributesDaniele Varrazzo2017-02-161-8/+9
|
* Merge branch 'async-keyword'Daniele Varrazzo2017-02-031-8/+8
|\ | | | | | | Close #495
| * Added async_ as an alias for asyncDaniele Varrazzo2017-02-031-8/+8
| | | | | | | | | | Added in argument for psycopg2.connect() and connection.__init__, and for the connection.async attribute.
* | Further skipping of slow testsDaniele Varrazzo2017-02-021-0/+2
| |
* | Allow skipping the slow testmanylinuxDaniele Varrazzo2017-02-021-1/+2
|/ | | | | | | | 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-4/+6
|
* Fix async replication and test.Oleksandr Shulgin2015-10-151-16/+0
|
* Added select.select timeout on AsyncTests.waitJason Erickson2014-05-191-2/+2
| | | | | | On Windows, the select.select() hangs/waits forever on the test_async_connection_error_message() test. Adding a 10 second timeout allows the tests to continue.
* Meaningful connection errors report a meaningful messageDaniele Varrazzo2013-10-161-0/+10
| | | | Fixes issue #173.
* Testing boilerplate unified in a single base classDaniele Varrazzo2013-04-071-9/+7
| | | | | The class makes a connection always available, allows creating new connection and closes everything on tear down.
* Fix tests for Postgres 9.3Catalin Iacob2013-03-161-0/+3
| | | | | | | Postgres 9.3 turns messages about implicit indexes and sequences from NOTICE to DEBUG1 so the tests fail with a default 9.3 server configuration because the client doesn't get any NOTICE. Fix it by also asking for DEBUG1 messages from the server when testing against Postgres >= 9.3.
* Force GC during weakref testsDaniele Varrazzo2011-12-261-0/+2
| | | | | Required to run the tests under PyPy with no refcount. See https://github.com/mvantellingen/psycopg2-ctypes/pull/15#issuecomment-3274618
* 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/+24
|\ | | | | | | | | | | | | | | | | 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/+24
| | | | | | | | As the test suite is now part of the source distribution.
* | Merge branch 'python2' into python3Daniele Varrazzo2011-01-031-0/+12
|\ \ | |/ | | | | | | | | | | | | Conflicts: NEWS-2.3 psycopg/connection_type.c tests/test_connection.py tests/types_basic.py
| * Broken circular reference in async executionDaniele Varrazzo2011-01-031-0/+12
| | | | | | | | | | | | If a connection is destroyed before an async operation is completed, the `async_cursor` member creates a reference loop, leaving the connection and the cursor alive. `async_cursor` is now a weak reference.
* | Test suite converted into a proper package.Daniele Varrazzo2010-12-211-9/+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.
* Deal uniformly with test servers without pg_sleep.Daniele Varrazzo2010-11-281-10/+8
|
* Don't consider the kernel not blocking us on write as an error.Daniele Varrazzo2010-11-251-1/+6
|
* Test cleanup.Daniele Varrazzo2010-11-191-11/+22
| | | | | | Tests pass or fail gracefully on older PostgreSQL versions. If unittest2 is available, skip tests instead of printing warnings.
* Making sync and async connection setup somewhat more consistent.Daniele Varrazzo2010-04-231-0/+5
|
* Dropped redundant call to conn_notice_process().Daniele Varrazzo2010-04-211-0/+9
| | | | | | | | | | | If the connection is sync, notices will be processed by pq_fetch() downstream. If the connection is async, here we have only sent the query: no result is ready yet, and neither notices have had a chance to arrive: they will be retrieved later by pq_is_busy(). Added tests to check the above statement don't break.
* Connection method 'executing()' renamed to 'isexecuting()'.Daniele Varrazzo2010-04-211-12/+12
|
* Connection method 'issync()' changed into the attribute 'async'.Daniele Varrazzo2010-04-211-3/+3
|
* Remove fileno() and poll() from cursorsJan Urbański2010-04-211-12/+30
| | | | | | | | Instead, the code should be using the fileno() and poll() methods of the cursor's connection. Handle the case when poll() is called on an already built connection as a request to poll the asynchronous query (if there is one) and get NOTIFY events. Update the tests to reflect that change, add a test for NOTIFY.
* Add one more test for errors involving two cursorsJan Urbański2010-04-201-0/+9
|
* Handle errors in asynchronous queries.Jan Urbański2010-04-201-0/+23
| | | | | | | | Do it by keeping the reference to the last PGresult in the cursor and calling pq_fetch() before ending the asynchronous execution. This takes care of handling the possible error state of the PGresult and also allows the removal of the needsfetch flag, since now after execution ends the results are already fetched and parsed.
* Merged tests from piro and jan async fixes branchesFederico Di Gregorio2010-04-141-3/+2
|
* Make the first poll() of an asynchronous connection return POLL_WRITE.Jan Urbański2010-04-141-36/+33
| | | | | | | | | | This hides from the user the libpq's implementation detail of requiring the first select() to wait for the connection socket to become writable and makes it possible to have a uniform select loop for both cursors and connections, in which you always start by polling the object and then acting according to the result from poll(). Idea and implementation by Daniele Varrazzo.
* Make polling a cursor that's not in an async query raise an exception.Jan Urbański2010-04-141-1/+28
| | | | | | | If there is an asynchronous query, polling a cursor that did not initiate it will raise an exception. Polling while there is no asynchronous query underway still works, because the user needs to have a way to get asynchronous NOTIFYs.
* Added a test to check poll() correctly calls PQflush.Daniele Varrazzo2010-04-111-0/+30
| | | | | | | When a large query is sent to the backend (and probably in high concurrency situations), writing the query could block. In this case PQflush() should be called until it returns 0. The test checks this is done correctly.
* test_async made properly executable.Daniele Varrazzo2010-04-111-0/+4
|
* Added test to check that connections subclasses can be asynchronous.Daniele Varrazzo2010-04-081-0/+11
|
* Adapt the tests to recent changesJan Urbański2010-04-051-54/+80
| | | | | | Some methods were forbidden in asynchronous mode, the isolation level of an asynchronous connection is not always 0 and these changes influenced expected test results.
* Add tests for the asynchronous APIJan Urbański2010-04-051-0/+252