Fix the errors in the test suite when MySQL is the backend
|Reported by:||Jim Dalton||Owned by:||Aymeric Augustin|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The work being done in #11665 had fixed all of the errors in the MySQL test run, but it's now broken again due to some recent movement in trunk. Due to other issues with that ticket, I decided it would be better if I split off the goal of fixing the MySQL errors into a separate ticket here.
I'll be attaching a patch that should fix all of the remaining errors in MySQL. The remaining issues are mostly an accumulation of minor errors that have accrued since MySQL does not get properly tested frequently enough. Here's a quick rundown of what the patch fixes:
- There are tests in
regressiontests.multiple_databasethat do some funky stuff with the data they load. Basically the load data that couldn't be loaded under normal circumstances. As of #3615 it's possible to disable constraint checks in MySQL to match the default testing behavior of the other backends, so I've done this in the pertinent spots. All tests now pass there.
- This ticket: #16026 improved the error message when loaddata tries to load invalid data. However, MySQL throws a
Warninginstead of raising
IntegrityError. I trapped the Warning and raise it as an exception and tweaked the test to account for that error type. Tests now pass in
regressiontests.admin_scripts.tests.ManageAlternateSettingswas hitting some errors because MySQL uses backticks instead of quotation marks. The tests were assuming backends all used quotation marks. I changed some of the output tests to regex and now they pass.
django.contrib.auth.tests.tokens.TokenGeneratorTest.test_10265says that a call to create_user and then a get of the same record should return the same password token. Because (at least for my MySQL installation) MySQL does not store microseconds, the second call to
user.last_login(used to create the token) does not have microseconds. The only way to ensure these tokens are always identical is to normalize the last_login datetime so that it's stripped of microseconds. With this fix the test passes.
These are disparate issues however most of them are minor. They are, as it stands, the only issues preventing MySQL from passing all tests. I'm not very well versed in any of them in particular, but if anyone sees a problem with my fixes let me know.
Marking as release blocker to ensure these get fixed before 1.4.
Change History (11)
comment:1 Changed 5 years ago by
|Patch needs improvement:||unset|