Marked tests of BinaryFields as expected failures on MySQL and Python 3.
Current ports of MySQLdb are very buggy in this area.
This commit is contained in:
parent
86b4ac665a
commit
7476d96f83
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 = []
|
||||
|
|
Loading…
Reference in New Issue