diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-12 09:47:15 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-12 09:47:15 -0400 |
commit | e982dacef6cf67035c0d57a959e24c1bd4205fb1 (patch) | |
tree | ef14190dfa96425e80882c97ef4a2607c39ecf79 | |
parent | 0eaeb99f2de1330a562752d30d02d1898f681cf8 (diff) | |
download | python-coveragepy-git-e982dacef6cf67035c0d57a959e24c1bd4205fb1.tar.gz |
test: add a test that self.stdout() works the way it says.
-rw-r--r-- | tests/test_testing.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py index eae18890..37130074 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -203,6 +203,15 @@ class CoverageTestTest(CoverageTest): assert "StdOut\n" in out assert "StdErr\n" in out + def test_stdout(self): + # stdout is captured. + print("This is stdout") + print("Line 2") + assert self.stdout() == "This is stdout\nLine 2\n" + # When we grab stdout(), it's reset. + print("Some more") + assert self.stdout() == "Some more\n" + class CheckUniqueFilenamesTest(CoverageTest): """Tests of CheckUniqueFilenames.""" |