Skip to content

Commit 1c653dd

Browse files
committed
"coverage debug premain"
1 parent d10e03c commit 1c653dd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

coverage/cmdline.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ def do_debug(self, args):
715715
"""Implementation of 'coverage debug'."""
716716

717717
if not args:
718-
show_help("What information would you like: config, data, sys?")
718+
show_help("What information would you like: config, data, sys, premain?")
719719
return ERR
720720

721721
for info in args:
@@ -747,6 +747,10 @@ def do_debug(self, args):
747747
config_info = self.coverage.config.__dict__.items()
748748
for line in info_formatter(config_info):
749749
print(" %s" % line)
750+
elif info == "premain":
751+
print(info_header("premain"))
752+
from coverage.debug import short_stack
753+
print(short_stack())
750754
else:
751755
show_help("Don't know what you mean by %r" % info)
752756
return ERR

doc/cmd.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,9 @@ command can often help::
498498
Three types of information are available:
499499

500500
* ``config``: show coverage's configuration
501-
* ``sys``: show system configuration,
501+
* ``sys``: show system configuration
502502
* ``data``: show a summary of the collected coverage data
503+
* ``premain``: show the call stack invoking coverage
503504

504505

505506
.. _cmd_run_debug:

tests/test_cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def test_combine_doesnt_confuse_options_with_args(self):
248248
""")
249249

250250
def test_debug(self):
251-
self.cmd_help("debug", "What information would you like: config, data, sys?")
251+
self.cmd_help("debug", "What information would you like: config, data, sys, premain?")
252252
self.cmd_help("debug foo", "Don't know what you mean by 'foo'")
253253

254254
def test_debug_sys(self):

0 commit comments

Comments
 (0)