# HG changeset patch # User Pierre-Yves David # Date 1411065827 25200 # Node ID 36a940d82f887f2282e5aae3568ec3c47c3a5c68 # Parent 939ce500c92a3dcc0e10815242361ff70a6fcae9 test: protect the run-tests.py --json test behind an hghave rule We add a rules to detect availability of a json module and skip if json is not available. diff -r 939ce500c92a -r 36a940d82f88 tests/hghave.py --- a/tests/hghave.py Mon Sep 29 17:23:38 2014 -0500 +++ b/tests/hghave.py Thu Sep 18 11:43:47 2014 -0700 @@ -281,6 +281,18 @@ def has_python243(): return sys.version_info >= (2, 4, 3) +@check("json", "some json module available") +def has_json(): + try: + if sys.version_info < (2, 7): + import simplejson as json + else: + import json + json.dumps + return True + except ImportError: + return False + @check("outer-repo", "outer repo") def has_outer_repo(): # failing for other reasons than 'no repo' imply that there is a repo diff -r 939ce500c92a -r 36a940d82f88 tests/test-run-tests.t --- a/tests/test-run-tests.t Mon Sep 29 17:23:38 2014 -0500 +++ b/tests/test-run-tests.t Thu Sep 18 11:43:47 2014 -0700 @@ -369,6 +369,8 @@ Skipped test-failure.t: blacklisted # Ran 0 tests, 2 skipped, 0 warned, 0 failed. +#if json + test for --json ================== @@ -412,3 +414,5 @@ "time": "\s*[\d\.]{5}" (re) } } (no-eol) + +#endif