summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-12 09:47:15 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-12 09:47:15 -0400
commite982dacef6cf67035c0d57a959e24c1bd4205fb1 (patch)
treeef14190dfa96425e80882c97ef4a2607c39ecf79
parent0eaeb99f2de1330a562752d30d02d1898f681cf8 (diff)
downloadpython-coveragepy-git-e982dacef6cf67035c0d57a959e24c1bd4205fb1.tar.gz
test: add a test that self.stdout() works the way it says.
-rw-r--r--tests/test_testing.py9
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."""