예제 #1
0
def test_stdout(capsys):
    br._stdout("Hello std_out", quiet=False)
    out, err = capsys.readouterr()
    assert out == "Hello std_out"

    br._stdout("Hello std_out", quiet=True)
    out, err = capsys.readouterr()
    assert out == ""
예제 #2
0
def test_std_errors(capfd, monkeypatch):
    monkeypatch.setattr(sys.stderr, "write", mock_unicodeencodeerror)
    br._stderr("Hello std_err α", quiet=False)
    out, err = capfd.readouterr()
    assert err == "Hello std_err α"

    monkeypatch.setattr(sys.stdout, "write", mock_unicodeencodeerror)
    br._stdout("Hello std_out α", quiet=False)
    out, err = capfd.readouterr()
    assert out == "Hello std_out α"