[Tutor] Missing in web.py and nosetests

李龑 eyeplum at gmail.com
Tue Aug 9 01:49:54 CEST 2011


Thanks Steven.

Sorry for trying to discuss nose or templates here :(

Do you actually have a template called "hello_form"? If not, then my *guess*
> is that this is an *error* (even though it prints F) because you don't
> actually have a template called hello_form.

Yes, I have this template, and the app runs well when I manually testing it
in a web browser. So I guess the promblem might be that the nose testing
system need some kind of special operations to make it know where the
template is(but actually I do have a *render =
web.template.render("templates/", base="layout" *in my app which declares
the place of the template).

Think I need to read more on those topics~_~

Thanks.



On Tue, Aug 9, 2011 at 3:02 AM, Steven D'Aprano <steve at pearwood.info> wrote:

> 李龑 wrote:
>
>> Hi all,
>>
>> I'm new in python and is learning about testing my little web.py app with
>> nosetests.
>>
>> When the app is running in the web browser, it's ok. And the terminal
>> returns something like "127.0.0.1:51936 - - [08/Aug/2011 23:00:37]
>> "HTTP/1.1
>> GET /hello" - 200 OK"
>>
>> But when I'm trying to test the app with nosetests, it always goes wrong.
>> As
>> I look into the Tracebacks, I guess this is caused by the templates I've
>> used in my app. But I'm not sure what should I do to make the nosetests
>> running right.
>>
>
>
> This is a forum for learning Python, not nose, or your web templating
> system. We can try to help, but you may have better luck on a dedicated nose
> forum, or on the main python-list at python.org mailing list (also available
> on Usenet comp.lang.python).
>
>
> I don't actually use nose, so it is hard for me to interpret the tracebacks
> you give. My *guess* is that you are reporting one test *error* (a test that
> fails because your code is broken) plus one test *failure* (a test which
> just fails).
>
>
> The first traceback you give seems to be an unexpected error:
>
>
>   File "/Library/Python/2.7/site-**packages/web/template.py", line 993, in
>>> _load_template
>>>    raise AttributeError, "No template named " + name
>>> AttributeError: No template named hello_form
>>> F
>>>
>>
> Do you actually have a template called "hello_form"? If not, then my
> *guess* is that this is an *error* (even though it prints F) because you
> don't actually have a template called hello_form.
>
>
> The second traceback seems to be a failing test:
>
>
>  AssertionError: Expected response '200' not in '500 Internal Server Error'
>>>
>>
> Your test expects a 500 Internal Server Error, but you actually get a 200
> OK response. So your test is wrong: it fails for no good reason.
>
>
> But I am not an expert on nose. I might be interpreting these tracebacks
> completely wrong.
>
>
> Aside:
>
> I can't find anything in the nose docs which explain how to read the test
> output except in the trivial case that all the tests pass.
>
> http://packages.python.org/**nose/index.html<http://packages.python.org/nose/index.html>
>
>
> --
> Steven
>
> ______________________________**_________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>



-- 

李龑  |  Li Yan
http://about.me/eyeplum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110809/2a515968/attachment-0001.html>


More information about the Tutor mailing list