Commit Graph

26 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
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
Daniele Varrazzo
d8b1fbd905 Further skipping of slow tests 2017-02-02 03:02:29 +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
91d2158de7 Python source cleanup using flake8 2016-10-11 00:11:55 +01:00
Daniele Varrazzo
1f330e9cac Allow connection.notices and notifies to be replaced.
Close #326
2015-06-02 17:02:04 +01:00
Daniele Varrazzo
5d86d07618 Testing external script independent from psycopg implementation
Patch needed to run the test suite on psycopg2cffi or psycopg2ct.
2013-04-19 23:01:28 +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
a97e2a842d Tweaks to test timing to avoid errors on test VMs 2011-02-20 19:33:22 +00:00
Daniele Varrazzo
79048ff19a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	tests/__init__.py
	tests/test_lobject.py
	tests/test_quote.py
	tests/testutils.py
2011-01-10 00:46:02 +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
0a4eeb4e13 Fixed notification tests to run on Py3.
Call 2to3 on the dynamically generated scripts.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
ade1b2cc7b Test suite converted into a proper package.
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.
2010-12-21 05:02:19 +00:00
Daniele Varrazzo
bbe28ba75f Add a small delay to receive notification when testing on busy network. 2010-11-19 14:44:47 +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
Daniele Varrazzo
11c021cb21 Fixed tests to run on Windows. 2010-11-11 10:39:35 +00:00
Daniele Varrazzo
77c0ab02d8 The Notify type is hashable.
If there is no payload, hash the same way the equivalent 2-tuple does.
Otherwise hash on the payload too.
2010-11-05 09:34:52 +00:00
Daniele Varrazzo
56ae1fe4bf Payload default is the empty string. 2010-11-05 09:34:52 +00:00
Daniele Varrazzo
9c58c01e0f Added comparison between Notify objects and Notify or tuple.
Explicit comparison with the tuple is required if we want to make
Notify() == (pid, channel) work: item access is not enough (and a test
in the suite fails if we get this wrong).
2010-11-05 09:34:52 +00:00
Daniele Varrazzo
4ec298e112 Notify object exposed in the extensions module. 2010-11-05 09:34:47 +00:00
Daniele Varrazzo
f435d15c95 Adding Notify object with payload. 2010-11-05 09:34:46 +00:00
Daniele Varrazzo
e651308287 Check the correctness of the PID in the notify tests. 2010-11-05 09:34:46 +00:00
Daniele Varrazzo
e82d2be64b More lenient test timeout for a slow (or busy) machine. 2010-04-23 13:24:35 +01:00
Daniele Varrazzo
02a28ff028 Notifications are automatically read after each query.
Added tests for basic notifications process.
2010-04-21 15:09:14 +01:00