def test_stderr(capsys): br._stderr("Hello std_err", quiet=False) out, err = capsys.readouterr() assert err == "Hello std_err" br._stderr("Hello std_err", quiet=True) out, err = capsys.readouterr() assert err == ""
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 α"