I ended up using the threading module to solve this for my needs. I create a class that inherits from Thread, and inside of the run() method, I create an instance of the test app, and do whatever requests I need to. I can create a bunch of these Classes and do a bunch of requests for each.
Note that this solution doesn't send a bunch of requests to a single test app instance, but rather it sends a single request to a single test app instance, but there are many test app instances going at the same time, so they hammer the database. My original problem was with the app interacting with the database, so this works for my needs right now. However, I would still be interested in how to write a test that sends a bunch of requests asynchronously to the paste.fixture test app. On Sep 16, 9:51 am, Bryan <[email protected]> wrote: > I have a function that updates a large table. My tests for this > function worked fine against the development database. It sometimes > fails on the production database however. The problem is that the > function locks the entire table while doing the update, so when > another user starts that function, it has to wait for the first user's > request to finish before it can start, and I get an InnoDB "Lock wait > timeout exceeded" error. > > I want to write a test to reproduce the error so I can recode it. How > can I write a controller test function that will send 2 requests > asynchronously? Should I be looking at the threading module, or does > paste/pylons/nosetests/unittests provide a solution? > > Something like: > > self.app.get('first request') > > # Wait 10 seconds. > > self.app.get('second request') > > # Assert that both completed. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
