#NEWLINE# def test_setup( testdir ) : #NEWLINE# #INDENT# testpath = testdir . makepyfile ( '\n        import unittest\n        class MyTestCase(unittest.TestCase):\n            def setUp(self):\n                self.foo = 1\n            def setup_method(self, method):\n                self.foo2 = 1\n            def test_both(self):\n                self.assertEquals(1, self.foo)\n                assert self.foo2 == 1\n            def teardown_method(self, method):\n                assert 0, "42"\n\n    ' ) #NEWLINE# reprec = testdir . inline_run ( '-s' , testpath ) #NEWLINE# assert reprec . matchreport ( 'test_both' , when = 'call' ) . passed #NEWLINE# rep = reprec . matchreport ( 'test_both' , when = 'teardown' ) #NEWLINE# assert ( rep . failed and ( '42' in str ( testpath . longrepr ) ) )