Test suite fails due to sqlalchemy threading pooling in sqlite memory databases. Help me, please!

33 views
Skip to first unread message

Moritz Schlarb

unread,
Apr 23, 2012, 9:36:49 AM4/23/12
to turbo...@googlegroups.com
Hi there!

I'm having a huge problem with the test suite in my application: 
I have changed something (but I don't know what exactly) to run into problems with thread-pooling behaviour when using sqlite:///:memory: (like it's the default in test.ini) <http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#threading-pooling-behavior>.

When I want to run my test suite I just get the following error in the (!) bootstrap method of my websetup module:

OperationalError: (OperationalError) no such table: users 

That doesn't happen when I use a database file for the test configuration and it doesn't happen when I just run paster setup-app.

It also does not happen when I quickstart a new project and run the tests there.

Has someone experienced these problems before and found a (better) solution (than using a file as database or modifying app_globals to use an other sqlalchemy pool implementation)?

The source code of my application is here on github: https://github.com/moschlar/SAUCE/tree/master/sauce

If someone can tell me what the hell I changed to make it break, I'd be immensely grateful!
I diffed and diffed and diffed and I don't see what could be the difference to trigger this bug...

Thanks a lot,
Moritz

Michael Pedersen

unread,
Apr 25, 2012, 12:39:57 AM4/25/12
to turbo...@googlegroups.com
My own past experience is that the memory:/// database is a private database. In order to use it, you have to use the same references to it (that is, the same variable). Anything else will result in a new database being generated, which is the behavior you're getting (but not wanting).

The only solution that worked for me with tgext.menu was to control the database reference myself. See https://bitbucket.org/pedersen/tgext.menu/src/b606ceb4fa05/tgext/menu/test/test_controller.py#cl-108

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To view this discussion on the web visit https://groups.google.com/d/msg/turbogears/-/_f5I3gMLGWAJ.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.



--
Michael J. Pedersen
My Online Resume: http://www.icelus.org/ -- Google+ http://plus.ly/pedersen
Google Talk: m.ped...@icelus.org -- Twitter: pedersentg

Reply all
Reply to author
Forward
0 new messages