Skip to content

Commit

Permalink
tests: add test for preserving newlines with capsys/capfd
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Jul 22, 2020
1 parent 04e27b1 commit f8f1dac
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions testing/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,14 @@ def test_hello(capfd):
)
reprec.assertoutcome(passed=1)

@pytest.mark.parametrize("fixturename", ("capfd", "capsys"))
@pytest.mark.parametrize("nl", ("\n", "\r\n", "\r"))
def test_preserves_newlines(self, fixturename, nl, request):
fixture = request.getfixturevalue(fixturename)
print("test", end=nl)
out, err = fixture.readouterr()
assert out == "test" + nl

@needsosdup
def test_capfdbinary(self, testdir):
reprec = testdir.inline_runsource(
Expand Down

0 comments on commit f8f1dac

Please sign in to comment.