我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用testfixtures.log_capture()。
def setUp(self): # If you depend on log messages, use testfixtures.log_capture() to test # for their presence and assert their contents. For the purposes of # the test runner, log messages on stdout/stderr are spam. logging.getLogger().setLevel(logging.WARNING)
def setUp(self): # If you depend on log messages, use testfixtures.log_capture() to test # for their presence and assert their contents. For the purposes of # the test runner, log messages on stdout/stderr are spam. logging.getLogger().setLevel(logging.WARNING) self._old_cwd = os.getcwd() self.temp_d = tempfile.mkdtemp() os.chdir(self.temp_d)