hghave: use a less brittle have-json check
authorAugie Fackler <raf@durin42.com>
Mon, 10 Nov 2014 13:27:25 -0500
changeset 23262 86a8658c77ff
parent 23261 79858e66a7ce
child 23263 dd51abf0aa17
hghave: use a less brittle have-json check
tests/hghave.py
--- a/tests/hghave.py	Wed Oct 15 12:39:19 2014 -0700
+++ b/tests/hghave.py	Mon Nov 10 13:27:25 2014 -0500
@@ -289,14 +289,17 @@
 @check("json", "some json module available")
 def has_json():
     try:
-        if sys.version_info < (2, 7):
-            import simplejson as json
-        else:
-            import json
+        import json
         json.dumps
         return True
     except ImportError:
-        return False
+        try:
+            import simplejson as json
+            json.dumps
+            return True
+        except ImportError:
+            pass
+    return False
 
 @check("outer-repo", "outer repo")
 def has_outer_repo():