#NEWLINE# def pytest_runtest_setup( item ) : #NEWLINE# #INDENT# global _current_class #NEWLINE# if ( not isinstance ( item , pytest . Function ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( _current_class is None ) : #NEWLINE# #INDENT# class_setup ( item . parent . parent ) #NEWLINE# _current_class = item . parent . parent #NEWLINE# def finalize( ) : #NEWLINE# #INDENT# global _current_class #NEWLINE# class_teardown ( item . parent . parent ) #NEWLINE# _current_class = None #NEWLINE# #UNINDENT# item . parent . parent . addfinalizer ( finalize ) #NEWLINE# #UNINDENT# test_setup ( item )