diff -r dfc61dc14f59 Lib/json/tests/test_scanstring.py --- a/Lib/json/tests/test_scanstring.py Mon Apr 11 00:26:42 2011 +0200 +++ b/Lib/json/tests/test_scanstring.py Tue Apr 12 15:33:49 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): self._test_scanstring(json.decoder.c_scanstring) diff -r dfc61dc14f59 Lib/json/tests/test_speedups.py --- a/Lib/json/tests/test_speedups.py Mon Apr 11 00:26:42 2011 +0200 +++ b/Lib/json/tests/test_speedups.py Tue Apr 12 15:33:49 2011 +0300 @@ -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")