Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 7476d96f83a004d674244aeb7a66289035427396 1 parent 86b4ac6
@aaugustin aaugustin authored
View
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: https://github.com/clelland/MySQL-for-Python-3
Creating your database
View
6 tests/model_fields/tests.py
@@ -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)
View
7 tests/serializers_regress/tests.py
@@ -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 = []
Please sign in to comment.
Something went wrong with that request. Please try again.