Thanks! That was what I was looking for! The problem now is that is you try to run the unit test the way it is described here (http://www.web2py.com/AlterEgo/default/show/213 ), I get this error: > python web2py.py -S init -M -R applications/myapp/tests/default.py
option -S not recognized Usage: web2py.py [options] [test] [...] Options: -h, --help Show this message -v, --verbose Verbose output -q, --quiet Minimal output Examples: web2py.py - run default set of tests web2py.py MyTestSuite - run suite 'MyTestSuite' web2py.py MyTestCase.testSomething - run MyTestCase.testSomething web2py.py MyTestCase - run all 'test*' test methods in MyTestCase If I just put a prin "Hello world!" inside the test file, everything works ok. So, I suppose that this file tries to load AGAIN the web2py environment and there is some sort of mix up? Any idea? On Feb 23, 3:23 am, Thadeus Burgess <thade...@thadeusb.com> wrote: > python web2py.py --help > > -S APPNAME, --shell=APPNAME > run web2py in interactive shell or IPython (if > installed) with specified appname > -T TEST_PATH, --test=TEST_PATH > run doctests in web2py environment; TEST_PATH like > a/c/f (c,f optiona > -R PYTHON_FILE, --run=PYTHON_FILE > run PYTHON_FILE in web2py environment; should be used > with --shell o > -M, --import_models auto import model files; default is False; should be > used with --shell option > > python web2py.py -T <yourapp>/<controller>/<function> > > It executes all doctests in environment. Have a look at sql.py for > example doctesting with a database (using a sqlite database) > > And if you want to use unittest > > python web2py.py -S <yourapp> -M -R > /path/to/web2py/applications/yourapp/tests/testControllerA.py > > Will execute the file inside of the web2py environment (with access to > database models as denoted by the -M option)' > > Now since we had such a difficult time finding these options, please > list links as to where the documentation on this subject can be > updated and explained further. > > -Thadeus > > On Mon, Feb 22, 2010 at 5:21 PM, spiffytech <spiffyt...@gmail.com> wrote: > > nside to doctests is they are harder to organize; you can't > > cleanly separate different sorts of tests that all relate to the same > > function (i.e., when a function is very sensitive to initial > > conditions). With external unit tests each logically distinct test can > > be represented with a distinct function, and that test can be run on > > it's own, without the overhead of any other tests (unlike doctests, > > where everything that tests a function must be run in order to test > > the part you're interes -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.