summaryrefslogtreecommitdiff
path: root/tests/composite_pk/tests.py
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-05 09:12:29 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-05 10:23:34 +0100
commit28f81a10190de9aa00925156c0005f6c787afeb3 (patch)
tree1044af7531b98e211aacf11aaaa35a4f83a2c0de /tests/composite_pk/tests.py
parent3d508ececbd3b7b652aedc66b0d3d2c7baa4795a (diff)
Refs #373 -- Fixed CompositePrimaryKey tests if yaml isn't installed.
Diffstat (limited to 'tests/composite_pk/tests.py')
-rw-r--r--tests/composite_pk/tests.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/composite_pk/tests.py b/tests/composite_pk/tests.py
index 1a0a327baf..25e5f2fdd5 100644
--- a/tests/composite_pk/tests.py
+++ b/tests/composite_pk/tests.py
@@ -1,7 +1,13 @@
import json
+import unittest
from uuid import UUID
-import yaml
+try:
+ import yaml # NOQA
+
+ HAS_YAML = True
+except ImportError:
+ HAS_YAML = False
from django import forms
from django.core import serializers
@@ -252,6 +258,7 @@ class CompositePKFixturesTests(TestCase):
},
)
+ @unittest.skipUnless(HAS_YAML, "No yaml library detected")
def test_serialize_user_yaml(self):
users = User.objects.filter(pk=(2, 3))
result = serializers.serialize("yaml", users)