changeset 23262:86a8658c77ff

hghave: use a less brittle have-json check
author Augie Fackler <raf@durin42.com>
date Mon, 10 Nov 2014 13:27:25 -0500
parents 79858e66a7ce
children dd51abf0aa17
files tests/hghave.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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():