##// END OF EJS Templates
tests: load json with no fallback...
Yuya Nishihara -
r28126:562a073a default
parent child Browse files
Show More
@@ -335,21 +335,6 b' def has_pygments():'
335 except ImportError:
335 except ImportError:
336 return False
336 return False
337
337
338 @check("json", "some json module available")
339 def has_json():
340 try:
341 import json
342 json.dumps
343 return True
344 except ImportError:
345 try:
346 import simplejson as json
347 json.dumps
348 return True
349 except ImportError:
350 pass
351 return False
352
353 @check("outer-repo", "outer repo")
338 @check("outer-repo", "outer repo")
354 def has_outer_repo():
339 def has_outer_repo():
355 # failing for other reasons than 'no repo' imply that there is a repo
340 # failing for other reasons than 'no repo' imply that there is a repo
@@ -48,6 +48,7 b' from __future__ import print_function'
48 from distutils import version
48 from distutils import version
49 import difflib
49 import difflib
50 import errno
50 import errno
51 import json
51 import optparse
52 import optparse
52 import os
53 import os
53 import shutil
54 import shutil
@@ -69,15 +70,6 b' from xml.dom import minidom'
69 import unittest
70 import unittest
70
71
71 osenvironb = getattr(os, 'environb', os.environ)
72 osenvironb = getattr(os, 'environb', os.environ)
72
73 try:
74 import json
75 except ImportError:
76 try:
77 import simplejson as json
78 except ImportError:
79 json = None
80
81 processlock = threading.Lock()
73 processlock = threading.Lock()
82
74
83 if sys.version_info > (3, 5, 0):
75 if sys.version_info > (3, 5, 0):
@@ -1725,8 +1717,6 b' class TextTestRunner(unittest.TextTestRu'
1725 xuf.write(doc.toprettyxml(indent=' ', encoding='utf-8'))
1717 xuf.write(doc.toprettyxml(indent=' ', encoding='utf-8'))
1726
1718
1727 if self._runner.options.json:
1719 if self._runner.options.json:
1728 if json is None:
1729 raise ImportError("json module not installed")
1730 jsonpath = os.path.join(self._runner._testdir, 'report.json')
1720 jsonpath = os.path.join(self._runner._testdir, 'report.json')
1731 with open(jsonpath, 'w') as fp:
1721 with open(jsonpath, 'w') as fp:
1732 timesd = {}
1722 timesd = {}
@@ -1,4 +1,3 b''
1 #require json
2 #require serve
1 #require serve
3
2
4 $ request() {
3 $ request() {
@@ -530,8 +530,6 b" Missing skips or blacklisted skips don't"
530 "result": "skip"
530 "result": "skip"
531 }
531 }
532 } (no-eol)
532 } (no-eol)
533 #if json
534
535 test for --json
533 test for --json
536 ==================
534 ==================
537
535
@@ -634,8 +632,6 b' Test that failed test accepted through i'
634 } (no-eol)
632 } (no-eol)
635 $ mv backup test-failure.t
633 $ mv backup test-failure.t
636
634
637 #endif
638
639 backslash on end of line with glob matching is handled properly
635 backslash on end of line with glob matching is handled properly
640
636
641 $ cat > test-glob-backslash.t << EOF
637 $ cat > test-glob-backslash.t << EOF
General Comments 0
You need to be logged in to leave comments. Login now