コード例 #1
0
 def test_simple_strict_asserted_by_check_present_unordered(self):
     log_capture = LogCapture(ensure_checks_above=ERROR)
     root.error('during')
     log_capture.uninstall()
     log_capture.check_present(("root", "ERROR", "during"),
                               order_matters=False)
     log_capture.ensure_checked()
コード例 #2
0
 def test_simple_strict_asserted_by_containment(self):
     log_capture = LogCapture(ensure_checks_above=ERROR)
     root.error('during')
     log_capture.uninstall()
     assert ("root", "ERROR", "during") in log_capture
     assert ("root", "INFO", "during") not in log_capture
     log_capture.ensure_checked()
コード例 #3
0
 def test_simple_strict(self):
     log_capture = LogCapture(ensure_checks_above=ERROR)
     root.error('during')
     log_capture.uninstall()
     with ShouldAssert(
             "Not asserted ERROR log(s): [('root', 'ERROR', 'during')]"):
         log_capture.ensure_checked()
コード例 #4
0
 def test_simple_strict_not_asserted_by_check_present(self):
     log_capture = LogCapture(ensure_checks_above=ERROR)
     root.error('before')
     root.error('during')
     log_capture.uninstall()
     log_capture.check_present(("root", "ERROR", "during"))
     with ShouldAssert(
             "Not asserted ERROR log(s): [('root', 'ERROR', 'before')]"):
         log_capture.ensure_checked()
コード例 #5
0
 def test_simple_strict_re_defaulted(self):
     with Replace('testfixtures.LogCapture.default_ensure_checks_above',
                  ERROR):
         LogCapture.default_ensure_checks_above = ERROR
         log_capture = LogCapture()
         root.error('during')
         log_capture.uninstall()
         with ShouldAssert(
                 "Not asserted ERROR log(s): [('root', 'ERROR', 'during')]"
         ):
             log_capture.ensure_checked()
コード例 #6
0
 def test_simple_strict_re_defaulted(self):
     old = LogCapture.default_ensure_checks_above
     try:
         LogCapture.default_ensure_checks_above = ERROR
         log_capture = LogCapture()
         root.error('during')
         log_capture.uninstall()
         with ShouldAssert("Not asserted ERROR log(s): [('root', 'ERROR', 'during')]"):
             log_capture.ensure_checked()
     finally:
         LogCapture.default_ensure_checks_above = old
コード例 #7
0
 def test_simple_strict_asserted_by_mark_all_checked(self):
     log_capture = LogCapture(ensure_checks_above=ERROR)
     root.error('during')
     log_capture.uninstall()
     log_capture.mark_all_checked()
     log_capture.ensure_checked()
コード例 #8
0
 def test_simple_strict_asserted_by_check(self):
     log_capture = LogCapture(ensure_checks_above=ERROR)
     root.error('during')
     log_capture.uninstall()
     log_capture.check(("root", "ERROR", "during"))
     log_capture.ensure_checked()