This was my solution:
class xxxx(TestCase): def setUp(self): import _mysql db=_mysql.connect('xxxx', 'xxxx', 'xxxx', "test_xxxxxxx") db.query(open('sql/xxxxxx.sql').read())
The sql file was a sequence of insert statements that I exported using phpMyAdmin. Reading sql statements is much faster than importing JSON or YAML. This is certainly not the most elegant solution, but it worked.
According to the third answer in Downloading SQL Dump before running Django tests, you just need to drop this sql file in the sql directory inside the application directory. This worked for me for the production database when running "manage.py syncdb", but for some reason this data was not actually imported into the test database when running the "management test .py", although the line is "Install custom SQL for xxxx.xxxx" appeared at the exit. So, I wrote my own code inside setUp ()
source share