test_subproc_runner.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:subprocrunner 作者: thombashi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号