User Tools

Site Tools


pytest_notes

This is an old revision of the document!


test a script that prints to stdout

tags | test case for print

snippet 1:

def test_foo(capsys):
    ...
    captured = capsys.readouterr()
    ...
    assert captured.out == expected_output

snippet 2:

out, error = capsys.readouterr()

run pytest on the current file from the current file

pytest_notes.1675263976.txt.gz · Last modified: 2023/02/01 15:06 by raju