I am trying to list all the functions in every encountered module to enforce the writing of test cases. However, I am having issues doing this with just the fullpath to the file as a string and not importing it. When I use inspect.getmembers(fullpath, inspect.isfunction) it returns an empty array. Is there any way to accomplish this? Here is my code so far:
import glob
import os
import inspect
def count_tests(moduletestdict):
    for key,value in moduletestdict.items():
        print("Key: {}".format(key))
        print(inspect.getmembers(key, inspect.isfunction))
def find_functions(base_dir):
    """moduletestdict has key value pairs where the key is the module
    to be tested and the value is the testing module"""
    moduletestdict = {}
    for roots, dirs, files in os.walk(base_dir):
        for f in files:
            if (".py" in f) and (".pyc" not in f) and ("test_" not in f) and (f != "__init__.py"):
                if "test_{}".format(f) in files:
                    moduletestdict["{}/{}".format(roots,f)] = "{}/{}".format(roots, "test_{}".format(f))
                else:   
                    moduletestdict["{}/{}".format(roots,f)] = "NOTEST"
    return moduletestdict
if __name__ == "__main__":
    base_dir = "/Users/MyName/Documents/Work/MyWork/local-dev/sns"
    moduletestdict = find_functions(base_dir)
    count_tests(moduletestdict)
 
     
    