I have the following code which works fine for running some tests
defined within a module:

def a_test():
    print "Test A"

def b_test():
    print "Test B"

if __name__ == "__main__":
    tests = ["%s()" % x for x in dir() if x.endswith("test")]

    for test in tests:
        eval(test)

But this feels like a hack... Is there a cleaner way for accessing the
functions of the current module similar to the __dict__ attribute of
classes? i.e. a way to access the local symbol table?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to