Help with WebClient and Pytest

106 views
Skip to first unread message

Ian W. Scott

unread,
Jun 26, 2013, 2:21:13 PM6/26/13
to web...@googlegroups.com
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:

    client = WebClient('http://127.0.0.1:8000/paideia/default/', postbacks=True)
    client
.get('index')

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

Vinicius Assef

unread,
Jun 26, 2013, 6:21:55 PM6/26/13
to web2py
See if something in https://github.com/viniciusban/web2py.test helps you.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Ian W. Scott

unread,
Jun 26, 2013, 6:39:51 PM6/26/13
to web...@googlegroups.com
Thanks, that looks really promising. I'll let you know what I come up with once I've had a chance to look through the repo.

Ian
Reply all
Reply to author
Forward
0 new messages