mirror of https://github.com/django/django.git
Properly skipped yaml tests when not installed
This commit is contained in:
parent
3e34005b1b
commit
e0643cb676
|
@ -5,6 +5,12 @@ import json
|
|||
from datetime import datetime
|
||||
import unittest
|
||||
from xml.dom import minidom
|
||||
try:
|
||||
import yaml
|
||||
HAS_YAML = True
|
||||
except ImportError:
|
||||
HAS_YAML = False
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.core import serializers
|
||||
|
@ -445,12 +451,9 @@ class JsonSerializerTransactionTestCase(SerializersTransactionTestBase, Transact
|
|||
}
|
||||
}]"""
|
||||
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
class YamlSerializerTestCase(SerializersTestBase, TestCase):
|
||||
|
||||
@unittest.skipUnless(HAS_YAML, "No yaml library detected")
|
||||
class YamlSerializerTestCase(SerializersTestBase, TestCase):
|
||||
serializer_name = "yaml"
|
||||
fwd_ref_str = """- fields:
|
||||
headline: Forward references pose no problem
|
||||
|
@ -509,7 +512,9 @@ else:
|
|||
ret_list.append(str(field_value))
|
||||
return ret_list
|
||||
|
||||
class YamlSerializerTransactionTestCase(SerializersTransactionTestBase, TransactionTestCase):
|
||||
|
||||
@unittest.skipUnless(HAS_YAML, "No yaml library detected")
|
||||
class YamlSerializerTransactionTestCase(SerializersTransactionTestBase, TransactionTestCase):
|
||||
serializer_name = "yaml"
|
||||
fwd_ref_str = """- fields:
|
||||
headline: Forward references pose no problem
|
||||
|
|
Loading…
Reference in New Issue