cpython: 500063f6ae5a (original) (raw)

Mercurial > cpython

changeset 69266:500063f6ae5a 2.7

#9233: skip _json-specific tests when _json is not available. [#9233]

Ezio Melotti
date Tue, 12 Apr 2011 15:59:50 +0300
parents 7b71872fb66a
children 61f25c9e7fa1
files Lib/json/tests/test_scanstring.py Lib/json/tests/test_speedups.py
diffstat 2 files changed, 14 insertions(+), 2 deletions(-)[+] [-] Lib/json/tests/test_scanstring.py 8 Lib/json/tests/test_speedups.py 8

line wrap: on

line diff

--- 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:

+except ImportError:

+ class TestScanString(TestCase): def test_py_scanstring(self): self._test_scanstring(json.decoder.py_scanstring)

--- 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:

+except ImportError:

+ +@skipUnless(_json, 'test requires the _json module') class TestSpeedups(TestCase): def test_scanstring(self): self.assertEqual(decoder.scanstring.module, "_json")