9 def isexecutable(filename):
10 infile = open(filename, 'r')
11 magic = infile.read(2)
18 for dirpath, dirs, files in os.walk("tests"):
20 [os.path.join(dirpath, filename) for filename in files
21 if filename.startswith("test") and filename.endswith(".py")
23 return [test[:-3].replace(os.sep, '.') for test in tests
24 if isexecutable(test)]
28 os.chdir(os.path.join(os.path.dirname(sys.argv[0]), os.pardir))
29 tests = collect_tests()
31 os.environ["PYTHONPATH"] = os.curdir
33 for test in sorted(tests):
35 subprocess.call((sys.executable, '-m', test))
37 if __name__ == '__main__':