diff options
-rw-r--r-- | coverage/debug.py | 4 | ||||
-rw-r--r-- | tests/test_debug.py | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/coverage/debug.py b/coverage/debug.py index d1f27cd8..12233959 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -279,7 +279,7 @@ def filter_text(text: str, filters: Iterable[Callable[[str], str]]) -> str: return text + ending -class CwdTracker: # pragma: debugging +class CwdTracker: """A class to add cwd info to debug messages.""" def __init__(self) -> None: self.cwd: Optional[str] = None @@ -293,7 +293,7 @@ class CwdTracker: # pragma: debugging return text -class DebugOutputFile: # pragma: debugging +class DebugOutputFile: """A file-like object that includes pid and cwd information.""" def __init__( self, diff --git a/tests/test_debug.py b/tests/test_debug.py index c2d9efe3..60a7b10a 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -239,22 +239,31 @@ class DebugOutputTest(CoverageTest): def test_stderr_default(self) -> None: self.debug_sys() - assert_good_debug_sys(self.stderr()) + out, err = self.stdouterr() + assert out == "" + assert_good_debug_sys(err) def test_envvar(self) -> None: self.set_environ("COVERAGE_DEBUG_FILE", "debug.out") self.debug_sys() - assert self.stderr() == "" + assert self.stdouterr() == ("", "") with open("debug.out") as f: assert_good_debug_sys(f.read()) def test_config_file(self) -> None: self.make_file(".coveragerc", "[run]\ndebug_file = lotsa_info.txt") self.debug_sys() - assert self.stderr() == "" + assert self.stdouterr() == ("", "") with open("lotsa_info.txt") as f: assert_good_debug_sys(f.read()) + def test_stdout_alias(self) -> None: + self.set_environ("COVERAGE_DEBUG_FILE", "stdout") + self.debug_sys() + out, err = self.stdouterr() + assert err == "" + assert_good_debug_sys(out) + def f_one(*args: Any, **kwargs: Any) -> str: """First of the chain of functions for testing `short_stack`.""" |