def test_doesnt_yield(self): def doesnt_yield(cls_self): # pylint: disable=unused-argument pass with self.assertRaises(test.InvalidTestError): test.yields_phases(doesnt_yield)(self)
def test_bad_yield(self): def bad_test(self): yield None # The InvalidTestError gets raised upon initial invocation of the test # method, so we need to do the wrapping inside the assertRaises context # rather than using the decorator on this test method itself and only # wrapping the yield statement in the assertRaises context. with self.assertRaises(test.InvalidTestError): test.yields_phases(bad_test)(self)
def test_doesnt_yield(self): def doesnt_yield(inner_self): pass with self.assertRaises(test.InvalidTestError): test.yields_phases(doesnt_yield)(self)