Problem with running tests with mysql database.

90 views
Skip to first unread message

Anton Samarchyan

unread,
Mar 10, 2017, 5:03:51 PM3/10/17
to Django developers (Contributions to Django itself)

I have a pull request in which some tests for some of environments are failing. (it's fine for the default tests with sqlite and some others) - https://github.com/django/django/pull/7994


Now, I am trying to run the tests with the database set to mysql.

I added a file settings_mysql.py which I put in the tests folder: http://pastebin.com/113Xx2Am


To try it out I use the master branch (commit c577d8a4981233b4d0f65c6ce57ae33d304095b9).

Then I run ./runtests.py --settings settings_mysql and I am getting errors.

Then I rerun it with parallel=1 - ./runtests.py --settings settings_mysql --parallel=1

and I get the following result:

FAILED (failures=56, errors=42, skipped=1046, expected failures=4)

Full log - https://paste.ee/p/Tfc9H


Does anyone have an idea what might be wrong and what is the best way to run tests for different databases?

Tim Graham

unread,
Mar 10, 2017, 5:14:31 PM3/10/17
to Django developers (Contributions to Django itself)
For the error, "Database returned an invalid datetime value. Are time zone definitions for your database installed?", see https://docs.djangoproject.com/en/dev/ref/databases/#time-zone-definitions.

Adding this to the 'default' and 'other' dictionaries in DATABASES may solve some of the encoding problems:

'TEST': {
    'CHARSET': 'utf8',
    'COLLATION': 'utf8_general_ci',
},

If you still have some errors after that, please post an updated output.

Adam Johnson

unread,
Mar 11, 2017, 3:32:02 AM3/11/17
to django-d...@googlegroups.com
For the lock wait timeout errors, it's probable something (another test run?) is still connected to the database and holding the locks. Try restarting mysql.

And if you are still having problems, knowing the version of MySQL you're using, plus how you installed it, would be helpful.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/6f86afff-c4c1-481e-8e17-7aae2cf0bde7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Adam

Josh Smeaton

unread,
Mar 11, 2017, 6:11:21 PM3/11/17
to Django developers (Contributions to Django itself)
If you're having issues with specific environments and configuring all of the dependencies, you can try using https://github.com/django/django-box which is a Vagrant virtual machine running on Virtualbox. It has postgres, mysql, sqlite, and all of the pythons Django uses for testing. You could also just take a look at the settings files it uses for testing: https://github.com/django/django-box/tree/master/roles/djangodata/files
Reply all
Reply to author
Forward
0 new messages