command_test.py 文件源码

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

项目:stakkr 作者: edyan 项目源码 文件源码
def test_command_without_stdout_ok(self):
        # TODO make it work under windows
        if os.name == 'nt':
            return

        f = io.StringIO()
        with redirect_stdout(f):
            launch_cmd_displays_output(self.cmd_ok, False, False)
        res = f.getvalue()
        self.assertEqual('.', res[:1])

        try:
            from contextlib import redirect_stderr
        except Exception:
            return

        f = io.StringIO()
        with redirect_stderr(f):
            launch_cmd_displays_output(self.cmd_ok, False, False)
        res = f.getvalue()
        self.assertEqual('', res)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号