Is there a library or a python magic that allows me to execute all functions in a file without explicitly calling them. Something very similar to what pytest is doing - running all functions that start with 'test_...' without ever registering them anywhere.
For example assume I have a file a.py:
def f1(): print "f1" def f2(): print "f2" and assume I have file - my main file - main.py:
if __name__ == '__main__': some_magic() so when I call:
python main.py The output would be:
f1 f2
inspectmodule in the standard library.