Well, I'm going to find out what is missing first. Based on that we can see what the best approach is.
On Sun, Jul 19, 2009 at 11:13, mdipierro<[email protected]> wrote: > > Let's brainstrom this before you code it. How should the testing > function know what is the environment you want to test? For example > the env variables are different if you use wsgi or fcgi. The app may > know what the expected env variables are (assuming the developer > knows), but the testing function cannot know this. > > On Jul 19, 2:27 am, Hans Donner <[email protected]> wrote: >> So, seeing from the code I should improve gluon.shell.test to setup a >> request.env (I'd rather not do it in the app itself) >> >> On Sun, Jul 19, 2009 at 08:55, mdipierro<[email protected]> wrote: >> >> > We could but that is not so much the issue here. The issue here admin >> > request an environment. A test does not provide a default environment. >> >> > If you want to test admin we should add >> >> > if not request.env: >> > request.env=Storage({....}) >> >> > and fill the ... >> >> > Massimo >> >> > On Jul 19, 1:42 am, Hans Donner <[email protected]> wrote: >> >> Perhaps we should have a setting indicatin if we are running in >> >> doctest mode, like we now have a gae mode. >> >> That way we can safely work around it. Or we can assume we are in such >> >> mode if some paramaters are empty, but that does not feel right. >> >> >> On Sun, Jul 19, 2009 at 01:35, mdipierro<[email protected]> wrote: >> >> >> > admin cannot be tested this way because assumes a request.env. >> >> > request.env is empty when testing. >> >> >> > On Jul 18, 5:57 pm, Hans Donner <[email protected]> wrote: >> >> >> when running: >> >> >> >> > python web2y.py --test=admin >> >> >> >> I get the tollowing output: >> >> >> >> Traceback (most recent call last): >> >> >> File "E:\dev\web2py\web2py\dev-tests\web2py\gluon\restricted.py", >> >> >> line 178, in >> >> >> restricted >> >> >> exec ccode in environment >> >> >> File "applications\admin\models/access.py", line 27, in <module> >> >> >> port = int(request.env.server_port) >> >> >> TypeError: int() argument must be a string or a number, not 'NoneType' >> >> >> >> also when I explictly give --port=8000 >> >> >> >> In the try..except I can try to catch it with except TypeError, but >> >> >> then what? >> >> >> >> (welcome and examples are running fine like this) > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

