summaryrefslogtreecommitdiffstats
path: root/Lib/json/tests
diff options
context:
space:
mode:
authorEzio Melotti <none@none>2011-04-12 12:59:50 (GMT)
committerEzio Melotti <none@none>2011-04-12 12:59:50 (GMT)
commit1b93021214531e1b825dd31e802838191beae581 (patch)
treee5204ba01c24751f7d86fed11cbeee459535b84d /Lib/json/tests
parent9d2ad441b916b3418c81cff4a03ab2242d9988f9 (diff)
downloadcpython-1b93021214531e1b825dd31e802838191beae581.zip
cpython-1b93021214531e1b825dd31e802838191beae581.tar.gz
cpython-1b93021214531e1b825dd31e802838191beae581.tar.bz2
#9233: skip _json-specific tests when _json is not available.
Diffstat (limited to 'Lib/json/tests')
-rw-r--r--Lib/json/tests/test_scanstring.py8
-rw-r--r--Lib/json/tests/test_speedups.py8
2 files changed, 14 insertions, 2 deletions
diff --git a/Lib/json/tests/test_scanstring.py b/Lib/json/tests/test_scanstring.py
index bf3ccd5..2a7ec82 100644
--- a/Lib/json/tests/test_scanstring.py
+++ b/Lib/json/tests/test_scanstring.py
@@ -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):
self._test_scanstring(json.decoder.c_scanstring)
diff --git a/Lib/json/tests/test_speedups.py b/Lib/json/tests/test_speedups.py
index 3b4ccb3..c6051cf 100644
--- a/Lib/json/tests/test_speedups.py
+++ b/Lib/json/tests/test_speedups.py
@@ -1,8 +1,14 @@
import decimal
-from unittest import TestCase
+from unittest import TestCase, skipUnless
from json import decoder, encoder, scanner
+try:
+ import _json
+except ImportError:
+ _json = None
+
+@skipUnless(_json, 'test requires the _json module')
class TestSpeedups(TestCase):
def test_scanstring(self):
self.assertEqual(decoder.scanstring.__module__, "_json")