We should identify a subset of web2py_utils that belongs to web2py
itself. Any unittest util I will be happy to include.

On May 5, 10:59 am, Thadeus Burgess <[email protected]> wrote:
> I am about to post a unittesting module as part of web2py_utils, it
> takes out all needed configurations for unittesting and makes it dead
> simple.
>
> --
> Thadeus
>
> On Wed, May 5, 2010 at 9:01 AM, mdipierro <[email protected]> wrote:
> > I am lost. If you want send me you app and data (confidentially) I
> > will take a look.
>
> > On May 5, 6:51 am, Matthew <[email protected]> wrote:
> >> Note that I've renamed my root web2py folder to 'app' as you'll see
> >> below.
>
> >> From console:
>
> >> >>> os.getcwd()
>
> >> '/home/matthew/dev/projects/mywebapp/src/app'
>
> >> >>> request.env.web2py_path
>
> >> Print statements from search_test.py:
>
> >> /home/matthew/dev/projects/mywebapp/src/app
> >> None
>
> >> On May 5, 12:01 am, mdipierro <[email protected]> wrote:
>
> >> > can you also print
>
> >> > os.getcwd() and request.env.web2py_path
>
> >> > On May 4, 10:26 pm, Matthew <[email protected]> wrote:
>
> >> > > From console:
>
> >> > > >>> db._folder
>
> >> > > 'applications/myapp/databases'>>> request.folder
>
> >> > > 'applications/myapp'
>
> >> > > Print statements from search_test.py, the unit test:
>
> >> > > applications/myapp/databases
> >> > > applications/myapp
>
> >> > > On May 4, 10:27 pm, mdipierro <[email protected]> wrote:
>
> >> > > > and what is in db._folder?
>
> >> > > > On May 4, 9:27 pm, mdipierro <[email protected]> wrote:
>
> >> > > > > Perhpas something is causing the test script to pick up the wrong
> >> > > > > database. What is in request.folder from console?
>
> >> > > > > On May 4, 8:44 pm, Matthew <[email protected]> wrote:
>
> >> > > > > > Thanks for the quick reply!
>
> >> > > > > > They are in the db. That's why running the code from the console 
> >> > > > > > works
> >> > > > > > and why it's puzzling that the script doesn't since the same
> >> > > > > > environment is set up.
>
> >> > > > > > On May 4, 9:28 pm, mdipierro <[email protected]> wrote:
>
> >> > > > > > > I do not think that line is the problem. Are the records in 
> >> > > > > > > the db
> >> > > > > > > already or are they stored by the unit_test?
>
> >> > > > > > > On May 4, 8:12 pm, Matthew <[email protected]> wrote:
>
> >> > > > > > > > I'm attempting to unit test a method by 
> >> > > > > > > > followinghttp://web2py.com/AlterEgo/default/show/260. If I 
> >> > > > > > > > run the query inside
> >> > > > > > > > the console, it works fine. If I run it in my unit tests, it 
> >> > > > > > > > returns
> >> > > > > > > > no results (NOTE that there are no errors in the unit test).
>
> >> > > > > > > > Here is the query:
>
> >> > > > > > > >     rows = db(db.flavor.id>0).select().\
> >> > > > > > > >         find(lambda row:row.name.startswith(term))
>
> >> > > > > > > > WORKS (17 results): python web2py.py -S myapp -M
> >> > > > > > > > DOES NOT WORK (0 results): python web2py.py -S myapp -M -R
> >> > > > > > > > applications/myapp/tests/test_search.py
>
> >> > > > > > > > Thanks,
> >> > > > > > > > Matthew

Reply via email to