diff Lib/json/tests/test_scanstring.py @ 69316:36e676a8541d 3.1

#9233: skip _json-specific tests when _json is not available.
author Ezio Melotti
date Wed, 13 Apr 2011 06:58:29 +0300
parents 2beb25369289
children ec6d881f5b02
line wrap: on
line diff
--- a/Lib/json/tests/test_scanstring.py	Wed Apr 13 09:35:37 2011 +0800
+++ b/Lib/json/tests/test_scanstring.py	Wed Apr 13 06:58:29 2011 +0300
@@ -1,14 +1,20 @@
 import sys
 import decimal
-from unittest import TestCase
+from unittest import TestCase, skipUnless
 
 import json
 import json.decoder
 
+try:
+    import _json
+except ImportError:
+    _json = None
+
 class TestScanString(TestCase):
     def test_py_scanstring(self):
         self._test_scanstring(json.decoder.py_scanstring)
 
+    @skipUnless(_json, 'test requires the _json module')
     def test_c_scanstring(self):
         if json.decoder.c_scanstring is not None:
             self._test_scanstring(json.decoder.c_scanstring)