@@ -11,34 +11,34 @@ class ModuleName(object):
1111 def __init__ (self , name ):
1212 self .module_name = name
1313
14- def __call__ (self , * param_arg ):
14+ def __call__ (self , test_class ):
1515 # Build the members dict manually using reversed MRO and __dict__.
1616 # We avoid inspect.getmembers() because it sorts alphabetically,
1717 # and we want to preserve the exact order the tests were defined in the file.
1818 # First, all test_metods of the derived class are executed, and then the methods of the base class
1919 members = {}
20- for base_class in param_arg [ 0 ] .__mro__ :
20+ for base_class in test_class .__mro__ :
2121 for name in base_class .__dict__ :
22- members .setdefault (name , getattr (param_arg [ 0 ] , name ))
22+ members .setdefault (name , getattr (test_class , name ))
2323
2424 for name , member in members .items ():
2525 if (name .startswith ("test" ) and
2626 (inspect .ismethod (member ) or inspect .isfunction (member ))):
2727 # setting attribute does not change order in __dict __ if it is already set
2828 # to achive correct order we first have to delete it, and then set it again
2929 try :
30- delattr (param_arg [ 0 ] , name )
30+ delattr (test_class , name )
3131 except AttributeError :
3232 pass
33- setattr (param_arg [ 0 ] , name , member )
33+ setattr (test_class , name , member )
3434
35- name_method = getattr (param_arg [ 0 ] , "name" , None )
35+ name_method = getattr (test_class , "name" , None )
3636 if not callable (name_method ):
3737 raise TypeError ("Class is missing name() method" )
3838
3939 @staticmethod
4040 def module_name ():
4141 return self .module_name
4242
43- setattr (param_arg [ 0 ] , "module_name" , module_name )
44- return param_arg [ 0 ]
43+ setattr (test_class , "module_name" , module_name )
44+ return test_class
0 commit comments