Skip to content
Browse files

Marked tests of BinaryFields as expected failures on MySQL and Python 3.

Current ports of MySQLdb are very buggy in this area.
  • Loading branch information...
1 parent 86b4ac6 commit 7476d96f83a004d674244aeb7a66289035427396 @aaugustin aaugustin committed May 8, 2013
Showing with 14 additions and 2 deletions.
  1. +3 −0 docs/ref/databases.txt
  2. +5 −1 tests/model_fields/
  3. +6 −1 tests/serializers_regress/
3 docs/ref/databases.txt
@@ -259,6 +259,9 @@ At the time of writing, the latest release of MySQLdb (1.2.4) doesn't support
Python 3. In order to use MySQL under Python 3, you'll have to install an
unofficial fork, such as `MySQL-for-Python-3`_.
+This port is still in alpha. In particular, it doesn't support binary data,
+making it impossible to use :class:`django.db.models.BinaryField`.
.. _MySQL-for-Python-3:
Creating your database
6 tests/model_fields/
@@ -6,7 +6,7 @@
from django import test
from django import forms
from django.core.exceptions import ValidationError
-from django.db import models, IntegrityError
+from django.db import connection, models, IntegrityError
from django.db.models.fields.files import FieldFile
from django.utils import six
from django.utils import unittest
@@ -455,6 +455,10 @@ def test_set_and_retrieve(self):
# Test default value
self.assertEqual(bytes(dm.short_data), b'\x08')
+ if connection.vendor == 'mysql' and six.PY3:
+ # Existing MySQL DB-API drivers fail on binary data.
+ test_set_and_retrieve = unittest.expectedFailure(test_set_and_retrieve)
def test_max_length(self):
dm = DataModel(short_data=self.binary_data*4)
self.assertRaises(ValidationError, dm.full_clean)
7 tests/serializers_regress/
@@ -26,7 +26,7 @@
from django.utils import six
from django.utils.encoding import force_text
from django.utils.functional import curry
-from django.utils.unittest import skipUnless
+from django.utils.unittest import expectedFailure, skipUnless
from .models import (BinaryData, BooleanData, CharData, DateData, DateTimeData, EmailData,
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
@@ -459,6 +459,11 @@ def serializerTest(format, self):
for klass, count in instance_count.items():
self.assertEqual(count, klass.objects.count())
+if connection.vendor == 'mysql' and six.PY3:
+ # Existing MySQL DB-API drivers fail on binary data.
+ serializerTest = expectedFailure(serializerTest)
def naturalKeySerializerTest(format, self):
# Create all the objects defined in the test data
objects = []

0 comments on commit 7476d96

Please sign in to comment.
Something went wrong with that request. Please try again.