We use SqlAlchemy but perhaps this will still help: We test anything dealing with transactions via Functional Tests or sometimes Integrated Tests, not Unit Tests.
For Functional Tests, look for examples in the docs that are based on `from webtest import TestApp`. I think I have an open source project or two that does this, and can check. Basically, we construct the test harness to create the database on setUp, making it available until tearDown. Then you invoke the logic by a route which calls the function, so a test looks something like this... def test_edit(self): res_new = self.testapp.get('/item_new', status=200) res_item_id = 1 # or regex the item id off the response dbItem = self.ctx.dbSession.query(model.Foo).order_by(model.Foo.id.desc()).first() assert item_id == dbItem.id if you're doing an edit flow, then you need to use a new dbSession (or clear the existing one) so the stale data doesn't persist. This works fine with testing via sqlite, mysql and postgres the general concept though is... * test harness creates a new database * the app uses the new database * queries in the test harness use the new database we also have some Integrated tests that spin up an instance of the Pyramid app, then make queries against it using a headless browser. to the best of my knowledge, those are the only ways to really test anything involving the transaction package -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To post to this group, send email to pylons-discuss@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/b946ab4e-d480-4516-9eae-00a9d245ae4d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.