Skip to content

Commit

Permalink
"coverage debug premain"
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Jan 10, 2020
1 parent 37797db commit 22b22e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion coverage/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def do_debug(self, args):
"""Implementation of 'coverage debug'."""

if not args:
show_help("What information would you like: config, data, sys?")
show_help("What information would you like: config, data, sys, premain?")
return ERR

for info in args:
Expand Down Expand Up @@ -747,6 +747,10 @@ def do_debug(self, args):
config_info = self.coverage.config.__dict__.items()
for line in info_formatter(config_info):
print(" %s" % line)
elif info == "premain":
print(info_header("premain"))
from coverage.debug import short_stack
print(short_stack())
else:
show_help("Don't know what you mean by %r" % info)
return ERR
Expand Down
3 changes: 2 additions & 1 deletion doc/cmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,9 @@ command can often help::
Three types of information are available:

* ``config``: show coverage's configuration
* ``sys``: show system configuration,
* ``sys``: show system configuration
* ``data``: show a summary of the collected coverage data
* ``premain``: show the call stack invoking coverage


.. _cmd_run_debug:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def test_combine_doesnt_confuse_options_with_args(self):
""")

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

def test_debug_sys(self):
Expand Down

0 comments on commit 22b22e6

Please sign in to comment.