debug: split 'sqlite' into its own category
diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml
index 80c5244..ce07e70 100644
--- a/.github/workflows/python-nightly.yml
+++ b/.github/workflows/python-nightly.yml
@@ -90,6 +90,7 @@
python -m sysconfig
python -c "import sys; print('GIL:', getattr(sys, '_is_gil_enabled', lambda: True)())"
python -m coverage debug sys
+ python -m coverage debug sqlite
python -m coverage debug pybehave
env | sort
diff --git a/CHANGES.rst b/CHANGES.rst
index fad09b1..424c3c8 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -23,7 +23,9 @@
Unreleased
----------
-Nothing yet.
+- Split ``sqlite`` debugging information out of the ``sys`` :ref:`coverage
+ debug <cmd_debug>` and :ref:`cmd_run_debug` options since it's bulky and not
+ very useful.
.. start-releases
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index d4733d4..49dfc2b 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -22,7 +22,7 @@
from coverage.config import CoverageConfig
from coverage.control import DEFAULT_DATAFILE
from coverage.core import CTRACER_FILE
-from coverage.data import combinable_files, debug_data_file
+from coverage.data import CoverageData, combinable_files, debug_data_file
from coverage.debug import info_header, short_stack, write_formatted_info
from coverage.exceptions import NoSource, CoverageException, _ExceptionDuringRun
from coverage.execfile import PyRunner
@@ -561,7 +561,8 @@
'sys' to show installation information;
'config' to show the configuration;
'premain' to show what is calling coverage;
- 'pybehave' to show internal flags describing Python behavior.
+ 'pybehave' to show internal flags describing Python behavior;
+ 'sqlite' to show SQLite compilation options.
"""
),
),
@@ -1035,7 +1036,10 @@
"""Implementation of 'coverage debug'."""
if not args:
- show_help("What information would you like: config, data, sys, premain, pybehave?")
+ show_help(
+ "What information would you like: "
+ + "config, data, sys, premain, pybehave, sqlite?"
+ )
return ERR
if args[1:]:
show_help("Only one topic at a time, please")
@@ -1057,6 +1061,8 @@
print(short_stack(full=True))
elif args[0] == "pybehave":
write_formatted_info(print, "pybehave", env.debug_info())
+ elif args[0] == "sqlite":
+ write_formatted_info(print, "sqlite", CoverageData.sys_info())
else:
show_help(f"Don't know what you mean by {args[0]!r}")
return ERR
diff --git a/coverage/control.py b/coverage/control.py
index 0d50783..b9d7b16 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -414,22 +414,24 @@
wrote_any = False
with self._debug.without_callers():
if self._debug.should("config"):
- config_info = self.config.debug_info()
- write_formatted_info(self._debug.write, "config", config_info)
+ write_formatted_info(self._debug.write, "config", self.config.debug_info())
wrote_any = True
if self._debug.should("sys"):
write_formatted_info(self._debug.write, "sys", self.sys_info())
for plugin in self._plugins:
header = "sys: " + plugin._coverage_plugin_name
- info = plugin.sys_info()
- write_formatted_info(self._debug.write, header, info)
+ write_formatted_info(self._debug.write, header, plugin.sys_info())
wrote_any = True
if self._debug.should("pybehave"):
write_formatted_info(self._debug.write, "pybehave", env.debug_info())
wrote_any = True
+ if self._debug.should("sqlite"):
+ write_formatted_info(self._debug.write, "sqlite", CoverageData.sys_info())
+ wrote_any = True
+
if wrote_any:
write_formatted_info(self._debug.write, "end", ())
@@ -1399,8 +1401,6 @@
if self._inorout is not None:
info.extend(self._inorout.sys_info())
- info.extend(CoverageData.sys_info())
-
return info
diff --git a/doc/commands/cmd_debug.rst b/doc/commands/cmd_debug.rst
index 8f25c3a..1d341f4 100644
--- a/doc/commands/cmd_debug.rst
+++ b/doc/commands/cmd_debug.rst
@@ -29,6 +29,7 @@
* ``data``: show a summary of the collected coverage data
* ``premain``: show the call stack invoking coverage
* ``pybehave``: show internal flags describing Python behavior
+* ``sqlite``: show internal compilation options for SQLite
.. [[[cog show_help("debug") ]]]
.. code::
@@ -40,7 +41,7 @@
problems. Topics are: 'data' to show a summary of the collected data; 'sys' to
show installation information; 'config' to show the configuration; 'premain'
to show what is calling coverage; 'pybehave' to show internal flags describing
- Python behavior.
+ Python behavior; 'sqlite' to show SQLite compilation options.
Options:
--debug=OPTS Debug options, separated by commas. [env: COVERAGE_DEBUG]
@@ -48,7 +49,7 @@
--rcfile=RCFILE Specify configuration file. By default '.coveragerc',
'setup.cfg', 'tox.ini', and 'pyproject.toml' are tried.
[env: COVERAGE_RCFILE]
-.. [[[end]]] (sum: ybjftkTaNE)
+.. [[[end]]] (sum: noWWXgVKcd)
.. _cmd_run_debug:
diff --git a/doc/python-coverage.1.txt b/doc/python-coverage.1.txt
index 2707d1c..7c988d9 100644
--- a/doc/python-coverage.1.txt
+++ b/doc/python-coverage.1.txt
@@ -154,7 +154,8 @@
``sys`` to show installation information;
``config`` to show the configuration;
``premain`` to show what is calling coverage;
- ``pybehave`` to show internal flags describing Python behavior.
+ ``pybehave`` to show internal flags describing Python behavior;
+ ``sqlite`` to show SQLite compilation options.
**erase**
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index ba373ff..16dc0ec 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -29,7 +29,7 @@
from tests import testenv
from tests.coveragetest import CoverageTest, OK, ERR, command_line
-from tests.helpers import os_sep, re_line
+from tests.helpers import os_sep, re_line, re_lines
class BaseCmdLineTest(CoverageTest):
@@ -389,7 +389,10 @@
@pytest.mark.parametrize(
"cmd, output",
[
- ("debug", "What information would you like: config, data, sys, premain, pybehave?"),
+ (
+ "debug",
+ "What information would you like: config, data, sys, premain, pybehave, sqlite?",
+ ),
("debug foo", "Don't know what you mean by 'foo'"),
("debug sys config", "Only one topic at a time, please"),
],
@@ -449,6 +452,15 @@
assert re.search(rf"(?m)^\s+do_debug : .*{s}coverage{s}cmdline.py:\d+$", out)
assert "do_debug : " in lines[-1]
+ def test_debug_sqlite(self) -> None:
+ self.command_line("debug sqlite")
+ out = self.stdout()
+ assert "sqlite3_sqlite_version:" in out
+ assert "sqlite3_compile_options:" in out
+ assert len(out.splitlines()) > 15
+ # Lots of lines of indented SQLite compile-time options.
+ assert len(re_lines(r"^ {20,35}[A-Z]{3}", out)) > 12
+
def test_erase(self) -> None:
# coverage erase
self.cmd_executes(
diff --git a/tests/test_debug.py b/tests/test_debug.py
index 629533c..e51607c 100644
--- a/tests/test_debug.py
+++ b/tests/test_debug.py
@@ -244,6 +244,11 @@
vtuple = ast.literal_eval(pyversion.partition(":")[-1].strip())
assert vtuple[:5] == sys.version_info
+ def test_debug_sqlite(self) -> None:
+ out_text = self.f1_debug_output(["sqlite"])
+ assert "sqlite3_compile_options:" in out_text
+ # The rest of the output is tested in test_cmdline.py:test_debug_sqlite
+
def test_debug_process(self) -> None:
out_text = self.f1_debug_output(["trace", "process"])
assert f"New process: pid={os.getpid()}, executable:" in out_text