def testSkippingUsingClassDecorator(self): class Skipped(TestCase): def runTest(self): self.assert_(False) Skipped = skip("Class Skip?")(Skipped) test_instance = Skipped() result = self.runner.run(test_instance) self.assertEqual(result.testsRun, 1) self.assertEqual(len(result.errors), 0) self.assertEqual(len(result.failures), 0) self.assertEqual(len(result.expectedFailures), 0) self.assertEqual(len(result.unexpectedSuccesses), 0) self.assertEqual(len(result.skipped), 1) self.assert_(result.wasSuccessful())
def testSkippingUsingClassDecorator(self): class Skipped(TestCase): def runTest(self): self.assert_(False) Skipped = skip("Class Skip?")(Skipped) test_instance = Skipped() result = self.runner.run(test_instance) self.assertEquals(result.testsRun, 1) self.assertEquals(len(result.errors), 0) self.assertEquals(len(result.failures), 0) self.assertEquals(len(result.expectedFailures), 0) self.assertEquals(len(result.unexpectedSuccesses), 0) self.assertEquals(len(result.skipped), 1) self.assert_(result.wasSuccessful())
called. """ def wrapper(self, *args, **kw): ret = func(self, *args, **kw) if kw.get('reindex', 1): self.tic() return ret return wrapper # Use this as a method or class decorator to tag it as TODO. # The test will be skipped: # - the fixture itself is not run # - if a TODO test is in fact successful, no one will ever know # # Test cases using this decorator must extend backportUnittest.TestCase todo_erp5 = backportUnittest.skip("TODO ERP5") class LogInterceptor: '''Replacement for Products.CMFCore.tests.base.testcase.LogInterceptor On CMF 1, LogInterceptor would bail if a log record with too high severity would pass through, and it would monkey-patch zLOG.log_write to do its job, meaning it would take on all Zope messages. The CMF 2 LogInterceptor plugs itself as a filter on the requested logger (the root logger, by default), which meant it would only be called on log records at that exact subsystem (not lower subsystems), and it no longer raises AssertionError on messages with high severity. This replacement restore the original semantics while keeping close to the new implementation, so it can act on both "zLOG" and "logging" calls.