diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-05-22 16:45:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-05-22 16:48:23 -0400 |
commit | a49ca095f5e7232a625f3c4ef438d9970d66902c (patch) | |
tree | 7eb029ebefa42020a8720694b05a42aef65c36ef /tests/test_data.py | |
parent | 8991e9d0812335c775654e544f429732154144bf (diff) | |
download | python-coveragepy-git-a49ca095f5e7232a625f3c4ef438d9970d66902c.tar.gz |
feat: a new debug option `sqldata` shows all the data being written to the db.
Diffstat (limited to 'tests/test_data.py')
-rw-r--r-- | tests/test_data.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/test_data.py b/tests/test_data.py index d20e3ff0..9f9a92bd 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -67,7 +67,12 @@ def DebugCoverageData(*args, **kwargs): lines in our coverage reports. """ assert "debug" not in kwargs - debug = DebugControlString(options=["dataio", "dataop", "sql"]) + options = ["dataio", "dataop", "sql"] + if kwargs: + # There's no reason kwargs should imply sqldata debugging. + # This is a way to get a mix of debug options across the tests. + options.extend(["sqldata"]) + debug = DebugControlString(options=options) return CoverageData(*args, debug=debug, **kwargs) @@ -160,15 +165,17 @@ class CoverageDataTest(CoverageTest): assert_line_counts(covdata, SUMMARY_3_4) assert_measured_files(covdata, MEASURED_FILES_3_4) - def test_cant_add_arcs_with_lines(self): - covdata = DebugCoverageData() + @pytest.mark.parametrize("klass", [CoverageData, DebugCoverageData]) + def test_cant_add_arcs_with_lines(self, klass): + covdata = klass() covdata.add_lines(LINES_1) msg = "Can't add branch measurements to existing line data" with pytest.raises(DataError, match=msg): covdata.add_arcs(ARCS_3) - def test_cant_add_lines_with_arcs(self): - covdata = DebugCoverageData() + @pytest.mark.parametrize("klass", [CoverageData, DebugCoverageData]) + def test_cant_add_lines_with_arcs(self, klass): + covdata = klass() covdata.add_arcs(ARCS_3) msg = "Can't add line measurements to existing branch data" with pytest.raises(DataError, match=msg): |