##// END OF EJS Templates
run-tests: write JSON reports to output dir
Siddharth Agarwal -
r32718:23287562 default
parent child Browse files
Show More
@@ -1925,7 +1925,7 b' class TextTestRunner(unittest.TextTestRu'
1925 self._writexunit(result, xuf)
1925 self._writexunit(result, xuf)
1926
1926
1927 if self._runner.options.json:
1927 if self._runner.options.json:
1928 jsonpath = os.path.join(self._runner._testdir, b'report.json')
1928 jsonpath = os.path.join(self._runner._outputdir, b'report.json')
1929 with open(jsonpath, 'w') as fp:
1929 with open(jsonpath, 'w') as fp:
1930 self._writejson(result, fp)
1930 self._writejson(result, fp)
1931
1931
@@ -1960,7 +1960,7 b' class TextTestRunner(unittest.TextTestRu'
1960 self._writexunit(result, xuf)
1960 self._writexunit(result, xuf)
1961
1961
1962 if self._runner.options.json:
1962 if self._runner.options.json:
1963 jsonpath = os.path.join(self._runner._testdir, b'report.json')
1963 jsonpath = os.path.join(self._runner._outputdir, b'report.json')
1964 with open(jsonpath, 'w') as fp:
1964 with open(jsonpath, 'w') as fp:
1965 self._writejson(result, fp)
1965 self._writejson(result, fp)
1966
1966
@@ -300,10 +300,10 b' test --xunit support'
300 <testcase name="test-success.t"/>
300 <testcase name="test-success.t"/>
301 </testsuite>
301 </testsuite>
302
302
303 $ rt --list-tests test-failure* --json --xunit=xunit.xml
303 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
304 test-failure-unicode.t
304 test-failure-unicode.t
305 test-failure.t
305 test-failure.t
306 $ cat report.json
306 $ cat output/report.json
307 testreport ={
307 testreport ={
308 "test-failure-unicode.t": {
308 "test-failure-unicode.t": {
309 "result": "success"
309 "result": "success"
@@ -836,6 +836,68 b' test for --json'
836 "time": "\s*[\d\.]{4,5}" (re)
836 "time": "\s*[\d\.]{4,5}" (re)
837 }
837 }
838 } (no-eol)
838 } (no-eol)
839 --json with --outputdir
840
841 $ rm report.json
842 $ rm -r output
843 $ mkdir output
844 $ rt --json --outputdir output
845
846 --- $TESTTMP/test-failure.t
847 +++ $TESTTMP/output/test-failure.t.err
848 @@ -1,5 +1,5 @@
849 $ echo babar
850 - rataxes
851 + babar
852 This is a noop statement so that
853 this test is still more bytes than success.
854 pad pad pad pad............................................................
855
856 ERROR: test-failure.t output changed
857 !.s
858 Skipped test-skip.t: missing feature: nail clipper
859 Failed test-failure.t: output changed
860 # Ran 2 tests, 1 skipped, 0 warned, 1 failed.
861 python hash seed: * (glob)
862 [1]
863 $ f report.json
864 report.json: file not found
865 $ cat output/report.json
866 testreport ={
867 "test-failure.t": [\{] (re)
868 "csys": "\s*[\d\.]{4,5}", ? (re)
869 "cuser": "\s*[\d\.]{4,5}", ? (re)
870 "diff": "---.+\+\+\+.+", ? (re)
871 "end": "\s*[\d\.]{4,5}", ? (re)
872 "result": "failure", ? (re)
873 "start": "\s*[\d\.]{4,5}", ? (re)
874 "time": "\s*[\d\.]{4,5}" (re)
875 }, ? (re)
876 "test-skip.t": {
877 "csys": "\s*[\d\.]{4,5}", ? (re)
878 "cuser": "\s*[\d\.]{4,5}", ? (re)
879 "diff": "", ? (re)
880 "end": "\s*[\d\.]{4,5}", ? (re)
881 "result": "skip", ? (re)
882 "start": "\s*[\d\.]{4,5}", ? (re)
883 "time": "\s*[\d\.]{4,5}" (re)
884 }, ? (re)
885 "test-success.t": [\{] (re)
886 "csys": "\s*[\d\.]{4,5}", ? (re)
887 "cuser": "\s*[\d\.]{4,5}", ? (re)
888 "diff": "", ? (re)
889 "end": "\s*[\d\.]{4,5}", ? (re)
890 "result": "success", ? (re)
891 "start": "\s*[\d\.]{4,5}", ? (re)
892 "time": "\s*[\d\.]{4,5}" (re)
893 }
894 } (no-eol)
895 $ ls -a output
896 .
897 ..
898 .testtimes
899 report.json
900 test-failure.t.err
839
901
840 Test that failed test accepted through interactive are properly reported:
902 Test that failed test accepted through interactive are properly reported:
841
903
General Comments 0
You need to be logged in to leave comments. Login now