summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-05-08 15:33:02 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-05-08 15:48:39 +0200
commit7476d96f83a004d674244aeb7a66289035427396 (patch)
tree2f6ed3a770b8e5ca3fb842b67256b03b8ccd8f1f
parent86b4ac665afe793a457ae84dfa1dfbbbb7e3c2bf (diff)
Marked tests of BinaryFields as expected failures on MySQL and Python 3.
Current ports of MySQLdb are very buggy in this area.
-rw-r--r--docs/ref/databases.txt3
-rw-r--r--tests/model_fields/tests.py6
-rw-r--r--tests/serializers_regress/tests.py7
3 files changed, 14 insertions, 2 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index f28079ae33..2ef048216f 100644
--- a/docs/ref/databases.txt
+++ b/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
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 9af8325040..035a5c2ae3 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -6,7 +6,7 @@ from decimal import Decimal
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 @@ class BinaryFieldTests(test.TestCase):
# 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)
diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py
index 72e3825d91..04b4d4c839 100644
--- a/tests/serializers_regress/tests.py
+++ b/tests/serializers_regress/tests.py
@@ -26,7 +26,7 @@ from django.test import TestCase
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 = []