diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 47a1601b4..57266e73c 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -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: @@ -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 diff --git a/doc/cmd.rst b/doc/cmd.rst index 3933c5671..cbbb26bbf 100644 --- a/doc/cmd.rst +++ b/doc/cmd.rst @@ -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: diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 666327c88..f5e8e96a8 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -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):