summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2012-02-10 01:13:38 +0000
committerJannis Leidel <jannis@leidel.info>2012-02-10 01:13:38 +0000
commit7019123d21f202bfce54ad30eb33ae9f4b3bcef9 (patch)
tree9ff1022c4196036eda6b6a10c1e606b4c00ca567 /tests
parentc1acda6d8f276dda9a962186e028c396a5a2e53c (diff)
Fixed the exception handling when deserializing via generators on Python 2.5 that was introduced in r17469. Also only test the YAML serializer if PyYAML is installed.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17487 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/serializers_regress/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/regressiontests/serializers_regress/tests.py b/tests/regressiontests/serializers_regress/tests.py
index efad176eaa..5abff6345f 100644
--- a/tests/regressiontests/serializers_regress/tests.py
+++ b/tests/regressiontests/serializers_regress/tests.py
@@ -17,12 +17,18 @@ try:
except ImportError:
from StringIO import StringIO
+try:
+ import yaml
+except ImportError:
+ yaml = None
+
from django.core import serializers
from django.core.serializers import SerializerDoesNotExist
from django.core.serializers.base import DeserializationError
from django.db import connection, models
from django.test import TestCase
from django.utils.functional import curry
+from django.utils.unittest import skipUnless
from .models import (BooleanData, CharData, DateData, DateTimeData, EmailData,
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
@@ -396,6 +402,7 @@ class SerializerTests(TestCase):
for obj in serializers.deserialize("json", """[{"pk":1}"""):
pass
+ @skipUnless(yaml, "PyYAML not installed")
def test_yaml_deserializer_exception(self):
with self.assertRaises(DeserializationError):
for obj in serializers.deserialize("yaml", "{"):