test/unittest_utils.py
branchstable
changeset 5377 84d14ddfae13
parent 5077 dc448c9ad9dd
child 5389 809d3b5b3d31
--- a/test/unittest_utils.py	Thu Apr 22 19:37:56 2010 +0000
+++ b/test/unittest_utils.py	Thu Apr 22 19:48:04 2010 +0000
@@ -14,10 +14,13 @@
 from cubicweb.utils import make_uid, UStringIO, SizeConstrainedList, RepeatList
 
 try:
-    import simplejson
+    try:
+        import json 
+    except ImportError:
+        import simplejson as json
     from cubicweb.utils import CubicWebJsonEncoder
 except ImportError:
-    simplejson = None
+    json = None
 
 class MakeUidTC(TestCase):
     def test_1(self):
@@ -107,11 +110,11 @@
 
 class JSONEncoderTC(TestCase):
     def setUp(self):
-        if simplejson is None:
-            self.skip('simplejson not available')
+        if json is None:
+            self.skip('json not available')
 
     def encode(self, value):
-        return simplejson.dumps(value, cls=CubicWebJsonEncoder)
+        return json.dumps(value, cls=CubicWebJsonEncoder)
 
     def test_encoding_dates(self):
         self.assertEquals(self.encode(datetime.datetime(2009, 9, 9, 20, 30)),