summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-11-20 09:45:01 -0500
committerNed Batchelder <ned@nedbatchelder.com>2022-11-20 10:58:33 -0500
commit1cd6c9bba0b4ba3018bf1b28fee645a7dd98fe68 (patch)
tree2e5e19653ad2d215a9f02758c18ade54d08f357d /tests
parent66c45143008366726293a341405d45a3a8e9ed87 (diff)
downloadpython-coveragepy-git-1cd6c9bba0b4ba3018bf1b28fee645a7dd98fe68.tar.gz
perf: more combine speed-ups
By avoiding writing metadata that differs but doesn't change the data, we get a higher hitrate on the hash-checking when combining. Use --debug=process to include these details for debugging.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_data.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_data.py b/tests/test_data.py
index b1a215e2..79c90420 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -904,6 +904,26 @@ class CoverageDataFilesTest(CoverageTest):
assert_measured_files(covdata3, MEASURED_FILES_1_2)
self.assert_file_count(glob.escape(basename) + ".*", 0)
+ def test_meta_data(self):
+ # The metadata written to the data file shouldn't interfere with
+ # hashing to remove duplicates, except for debug=process, which
+ # writes debugging info as metadata.
+ debug = DebugControlString(options=[])
+ covdata1 = CoverageData(basename="meta.1", debug=debug)
+ covdata1.add_lines(LINES_1)
+ covdata1.write()
+ with sqlite3.connect("meta.1") as con:
+ data = sorted(k for (k,) in con.execute("select key from meta"))
+ assert data == ["has_arcs", "version"]
+
+ debug = DebugControlString(options=["process"])
+ covdata2 = CoverageData(basename="meta.2", debug=debug)
+ covdata2.add_lines(LINES_1)
+ covdata2.write()
+ with sqlite3.connect("meta.2") as con:
+ data = sorted(k for (k,) in con.execute("select key from meta"))
+ assert data == ["has_arcs", "sys_argv", "version", "when"]
+
class DumpsLoadsTest(CoverageTest):
"""Tests of CoverageData.dumps and loads."""