def test_stderr(
self, capsys, command, ignore_stderr_regexp, out_regexp, expected):
import logbook
import subprocrunner
logbook.StderrHandler(
level=logbook.DEBUG).push_application()
subprocrunner.set_log_level(logbook.INFO)
runner = SubprocessRunner(
command, ignore_stderr_regexp=ignore_stderr_regexp)
runner.run()
assert is_null_string(runner.stdout.strip())
assert is_not_null_string(runner.stderr.strip())
out, err = capsys.readouterr()
print("[sys stdout]\n{}\n".format(out))
print("[sys stderr]\n{}\n".format(err))
print("[proc stdout]\n{}\n".format(runner.stdout))
print("[proc stderr]\n{}\n".format(runner.stderr))
actual = out_regexp.search(err) is not None
assert actual == expected
评论列表
文章目录