python - What is an elegant way to perform a set of statements for all pytest tests? -


i writing first py.test tests , have written tests below

class test_x_values(object):    def test_value_1(self, fix_a):        = fix_a['first']        b = fix_a['second']        # statements here        #the following part common        if ( a.x == true , b.y == true):            #perform something. example            print 'performing'     def test_value_2(self, fix_a):        #some statements        if ( a.x == true , b.y == true):            #perform something. example            print 'performing' 

so decided write function

def check(self, a, b):    if ( a.x == true , b.y == true):       #perform something. example       print 'performing' 

is there elegant way perform function 'check' @ end of every tests other writing check(a,b) @ end of every tests?