It is not clear why you want to do this. Usually in something like unittest you should enter input in your class and then reference it inside each test method.
Use validation and export.
from inspect import ismethod
def call_all(obj, *args, **kwargs):
for name in dir(obj):
attribute = getattr(obj, name)
if ismethod(attribute):
attribute(*args, **kwargs)
class Test():
def a(self, input):
print "a: " + input
def b(self, input):
print "b: " + input
def c(self, input):
print "c: " + input
call_all(Test(), 'my input')
Conclusion:
a: my input
b: my input
c: my input
source
share