[Tutor] Missing in web.py and nosetests

Steven D'Aprano steve at pearwood.info
Tue Aug 9 02:02:55 CEST 2011

李龑 wrote:
> Thanks Steven.
> Sorry for trying to discuss nose or templates here :(

No need to be sorry, it isn't forbidden, but you may have more success 
asking help elsewhere.

>> 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).

Then my guess is that the difference might be because you are calling 
the nose tests from a different working directory than the web browser 
sees. Can you get the app to display os.getcwd(), and then write a test 
that compares the working directory as seen by nose to the working 
directory as seen by the web app? Or change the template location to be 
an absolute pathname.

Also check the permissions on the templates. Perhaps the template is 
readable by whatever user is running the web server, but not by whatever 
user is running the nose tests.

All these suggestions are wild guesses, you understand.

Good luck.


More information about the Tutor mailing list