Mike Orr wrote: > You generally want to use a test database rather than depending on a > rollback to preserve the live data, because who knows when something > might go wrong (e.g.,, a stray commit you didn't notice).
True. Although I wonder how fixture (http://code.google.com/p/fixture/) reverts the changes it makes at the end of each test? (cc'ing in Kumar in case he can provide a short summary :-) ) > You can create and populate the database in the setUp function Nose > runs, and drop the tables in the tearDown function. These functions > can be run for every test or only on on entering/exiting the module, > depending on how you name them them. Yep, I do like this about Nose. I guess zope.testing's Layers concept would work well with this too... > want to do part of that thing. Beware that if you have configured > websetup.py this way, it will be run for every test unless you disable > that. Yeah, I moved the calls to a package-level setUp function in my functional tests sub-package. > If your data is mainly added to rather than modified in place, you may > want to test against real data collected a month or two ago. In that > case you may want the real database or a copy of it, but the database > may be too large to create/import multiple times during a test. In > that case it gets a bit more difficult, plus you actually have to > import the data from somewhere rather than inserting fixed dummy data. > Perhaps in this case you'll want to load it from a SQL dump file made > earlier, or a tab-delimited file. Are there any tool sets that support this kind of thing? So far I've only found Kumar's fixture package, are there any others like it? > If you put only your read-only tests in the Pylons app and keep your > read-write tests elsewhere, then it would be safer to run the > read-only tests against the live database. I don't think I'd ever be insane enough to run tests against a live database ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---