I'm working on the new version of WP1.0 Bot that is being re-written in Python.
The general operation of the bot is to read data from enwiki_p and write data to it's own database based on what it finds.
As outlined in the wiki page for the rewrite, I initially wrote this using SQLAlchemy, but it was 10x too slow. I'm now trying to re-write using pymysql and raw database access.
This provides a problem for my unit tests (which I am also largely re-writing) because with SQLAlchemy I could access an in-memory sqlite database in a database agnostic way, but now MySQL specific database langauge, such as "ON DUPLICATE KEY UPDATE", create problems in tests.
What I would like is some kind of test database that I could populate and destroy, possibly with fixtures, on every test run. I'm thinking of something modeled on the Ruby on Rails system, where there is the production database of course, mytool_prod, but also a mytool_test database. Of course, I'm definitely worried about "crossing the streams" and making sure that my test code only destroys the test database. Perhaps I could have a different db user that I use in tests that only has access to the test database?
I'd also like to mock out the enwiki_p database, so I can populate it with fake data in tests and make sure my code is processing it correctly.
I have Travis CI set up for the project, based on the in-memory sqlite database, and I would love to also have it set up for CI with whatever solution I come up with for the test database.
Thanks for any insight on how this might be done or if I'm going down a completely insane path.