without the exact test code difficult to say, but in what you shows, I
would have put a db.commit() after the db(db.table.id>0).delete()...

And this may easily explained the lock of db.

Richard

On Tue, Mar 3, 2015 at 10:21 AM, Mark Graves <[email protected]> wrote:

> I've been encountering some strange issues that I have never seen before.
>
> I'm running some a complete regression suite on an application. It's
> pretty long running, in the current iteration. (over 400 seconds).
>
> This includes a number of browser automation tasks using python and
> selenium.
>
> For anyone familiar with py.test,
>
> I'm using a fixture to grab access to the database to make sure the logic
> is working properly.
>
> Namely:
>
> from gluon.shell import env
>
> from gluon.storage import Storage
>
> @pytest.fixture()
>
> def db():
>
>     web2py_env = env(appname, import_models=True)
>
>     web2py_env = Storage(web2py_env)
>
>     db = web2py_env.db
>
>     return db
> When I use a sqlite database, I'm encountering lock issues, on a query
> where there really shouldn't be lock issues.
>
> It's a simple delete query, run before a test to ensure the appropriate
> table is empty.
>
> psuedocode:
>
> db(db.table.id>0).delete()
> driver.get(url)
>
> When running this separately as a test, or within a group of tests, it
> works fine, no lock issues.
>
> When running this in the full regression, I'm getting database lock issues.
>
> Then I switched to postgres for testing (I know -- cheap and dirty, but I
> wanted to see if that was really the issue).
>
> So, then I started getting even stranger errors from gluon.contrib.pg8000
>
> namely:
>
> NoData Object
> Msg Query Idle Object
>
> etc. etc.
>
> In the course of testing, I've seen basically every one of the possible
> pg8000 errors in the source.
>
> Anyone have any clues as to where I might be able to track down the source?
>
> Is it a thread issue, where I should have done from gluon import current
> and then set the db in the function?
>
> I'm wondering if this is something to do with pytest's internals or
> web2py's or my own code.
>
> Any thoughts would be greatly appreciated.
>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to