From e982dacef6cf67035c0d57a959e24c1bd4205fb1 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 12 Oct 2021 09:47:15 -0400 Subject: test: add a test that self.stdout() works the way it says. --- tests/test_testing.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') 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.""" -- cgit v1.2.1