#NEWLINE# @ pytest . mark . parametrize ( 'type' , [ 'Error' , 'Failure' ] ) #NEWLINE# def test_testcase_adderrorandfailure_defers( testdir , type ) : #NEWLINE# #INDENT# testdir . makepyfile ( ( '\n        from unittest import TestCase\n        import pytest\n        class MyTestCase(TestCase):\n            def run(self, result):\n                excinfo = pytest.raises(ZeroDivisionError, lambda: 0/0)\n                try:\n                    result.add%s(self, excinfo._excinfo)\n                except KeyboardInterrupt:\n                    raise\n                except:\n                    pytest.fail("add%s should not raise")\n            def test_hello(self):\n                pass\n    ' % ( type , testdir ) ) ) #NEWLINE# result = testdir . runpytest ( ) #NEWLINE# assert ( 'should not raise' not in result . stdout . str ( ) )