tests: load json with no fallback
authorYuya Nishihara <yuya@tcha.org>
Sat, 09 Jan 2016 13:20:15 +0900
changeset 28126 562a073a2a1b
parent 28125 3b4537ba80e9
child 28127 807bc140e915
tests: load json with no fallback The json module should be available in Python 2.6 or newer.
tests/hghave.py
tests/run-tests.py
tests/test-hgweb-json.t
tests/test-run-tests.t
--- a/tests/hghave.py	Tue Dec 15 23:50:48 2015 +0900
+++ b/tests/hghave.py	Sat Jan 09 13:20:15 2016 +0900
@@ -335,21 +335,6 @@
     except ImportError:
         return False
 
-@check("json", "some json module available")
-def has_json():
-    try:
-        import json
-        json.dumps
-        return True
-    except ImportError:
-        try:
-            import simplejson as json
-            json.dumps
-            return True
-        except ImportError:
-            pass
-    return False
-
 @check("outer-repo", "outer repo")
 def has_outer_repo():
     # failing for other reasons than 'no repo' imply that there is a repo
--- a/tests/run-tests.py	Tue Dec 15 23:50:48 2015 +0900
+++ b/tests/run-tests.py	Sat Jan 09 13:20:15 2016 +0900
@@ -48,6 +48,7 @@
 from distutils import version
 import difflib
 import errno
+import json
 import optparse
 import os
 import shutil
@@ -69,15 +70,6 @@
 import unittest
 
 osenvironb = getattr(os, 'environb', os.environ)
-
-try:
-    import json
-except ImportError:
-    try:
-        import simplejson as json
-    except ImportError:
-        json = None
-
 processlock = threading.Lock()
 
 if sys.version_info > (3, 5, 0):
@@ -1725,8 +1717,6 @@
                     xuf.write(doc.toprettyxml(indent='  ', encoding='utf-8'))
 
             if self._runner.options.json:
-                if json is None:
-                    raise ImportError("json module not installed")
                 jsonpath = os.path.join(self._runner._testdir, 'report.json')
                 with open(jsonpath, 'w') as fp:
                     timesd = {}
--- a/tests/test-hgweb-json.t	Tue Dec 15 23:50:48 2015 +0900
+++ b/tests/test-hgweb-json.t	Sat Jan 09 13:20:15 2016 +0900
@@ -1,4 +1,3 @@
-#require json
 #require serve
 
   $ request() {
--- a/tests/test-run-tests.t	Tue Dec 15 23:50:48 2015 +0900
+++ b/tests/test-run-tests.t	Sat Jan 09 13:20:15 2016 +0900
@@ -530,8 +530,6 @@
           "result": "skip"
       }
   } (no-eol)
-#if json
-
 test for --json
 ==================
 
@@ -634,8 +632,6 @@
   } (no-eol)
   $ mv backup test-failure.t
 
-#endif
-
 backslash on end of line with glob matching is handled properly
 
   $ cat > test-glob-backslash.t << EOF