I'm trying to use WebClient in a pytest suite and getting an error that I don't understand. I try to connect like this:
But client.get('index') throws an error. The error arises in urllib2.py line 1184:
URLError: <urlopen error [Errno 111] Connection refused>
I assume this means that the rocket server isn't running properly. But I can't quite see what the problem is. I set up the test suite like this:
1. from the command-line I launch web2py in the app "paideia" and execute the test launcher (runtest.py) in that web2py environment:
python ~/web/web2py/web2py.py -S --ip=127.0.0.1 --port=8000 --password=password paideia -M -R applications/paideia/bin/runtest.py
2. In runtest.py I call pytest programmatically:
import pytest
pytest.main(path/to/test/dir/)
3. Pytest then finds my test suite file (there's only one so far) and runs the test, running into the error when I try to access default/index via the webclient.
The strange thing is that the web2py environment seems to be there. I have access to current and to db. But the http connection seems to fail.
Any help would be greatly appreciated!
Ian