def test_debug_main(self): self.skip_unless_data_storage_is("json") covdata1 = CoverageData(".coverage") covdata1.add_lines(LINES_1) covdata1.write() debug_main([]) covdata2 = CoverageData("arcs.dat") covdata2.add_arcs(ARCS_3) covdata2.add_file_tracers({"y.py": "magic_plugin"}) covdata2.add_run_info(version="v3.14", chunks=["z", "a"]) covdata2.write() covdata3 = CoverageData("empty.dat") covdata3.write() debug_main(["arcs.dat", "empty.dat"]) expected = { ".coverage": { "lines": { "a.py": [1, 2], "b.py": [3], }, }, "arcs.dat": { "arcs": { "x.py": [[-1, 1], [1, 2], [2, 3], [3, -1]], "y.py": [[-1, 17], [17, 23], [23, -1]], }, "file_tracers": { "y.py": "magic_plugin" }, "runs": [ { "chunks": ["z", "a"], "version": "v3.14", }, ], }, "empty.dat": {}, } pieces = re.split(r"(?m)-+ ([\w.]+) -+$", self.stdout()) for name, json_out in zip(pieces[1::2], pieces[2::2]): json_got = json.loads(json_out) canonicalize_json_data(json_got) self.assertEqual(expected[name], json_got)
def test_debug_main(self): self.skip_unless_data_storage_is("json") covdata1 = CoverageData(".coverage") covdata1.add_lines(LINES_1) covdata1.write() debug_main([]) covdata2 = CoverageData("arcs.dat") covdata2.add_arcs(ARCS_3) covdata2.add_file_tracers({"y.py": "magic_plugin"}) covdata2.add_run_info(version="v3.14", chunks=["z", "a"]) covdata2.write() covdata3 = CoverageData("empty.dat") covdata3.write() debug_main(["arcs.dat", "empty.dat"]) expected = { ".coverage": { "lines": { "a.py": [1, 2], "b.py": [3], }, }, "arcs.dat": { "arcs": { "x.py": [[-1, 1], [1, 2], [2, 3], [3, -1]], "y.py": [[-1, 17], [17, 23], [23, -1]], }, "file_tracers": {"y.py": "magic_plugin"}, "runs": [ { "chunks": ["z", "a"], "version": "v3.14", }, ], }, "empty.dat": {}, } pieces = re.split(r"(?m)-+ ([\w.]+) -+$", self.stdout()) for name, json_out in zip(pieces[1::2], pieces[2::2]): json_got = json.loads(json_out) canonicalize_json_data(json_got) self.assertEqual(expected[name], json_got)