guv
guv copied to clipboard
Port remaining tests from gevent/eventlet where appropriate
Use py.test, and make use of fixtures and with pytest.raises()
.
Most gevent/eventlet tests are valid for guv, but the annoying part is turning them from unittest format into py.test format.
I might be able start gradually porting, but what is the testing setup? I must be missing something since running pytest
bombs on a relative import.
$ pytest .
going into /home/isaac2/programming/guv/guv/tests
========================= test_greenio.py ==========================
unhandled exception occurred while testing test_greenio
Traceback (most recent call last):
File "/usr/local/lib/python3.3/dist-packages/logilab/common/pytest.py", line 427, in testfile
options=self.options, outstream=sys.stderr)
File "/usr/local/lib/python3.3/dist-packages/logilab/common/pytest.py", line 743, in __init__
testLoader=NonStrictTestLoader())
File "/usr/lib/python3.3/unittest/main.py", line 95, in __init__
self.module = __import__(module)
File "./test_greenio.py", line 7, in <module>
from .. import spawn
SystemError: Parent module '' not loaded, cannot perform relative import
*******************************************************************************
Ran 1 test cases in 0.00s (0.00s CPU), 1 errors
0 modules OK (1 failed)
failures: /home/isaac2/programming/guv/guv/tests/test_greenio [1/1]
Thanks for helping with this!
- Make sure you have pulled the latest changes from
develop
. - In the root directory, simply run
py.test
. I started porting the socket test from eventlet/gevent so you can see how it's done using py.test. So far, everything is passing.
Ah, got it. I always forget that installing a dependency in an active virtualenv doesn't update your PATH, so you have to reactivate or it uses system path which had pytest installed... Oops.
Are you using ZSH? If so, you just need to do rehash
. If you're using bash, you shouldn't need to reactivate I believe. Also, I am using pyvenv (now built in to python 3.4), not the old virtualenv
package everyone is using, so it might be that as well.