# Alternative to find ... -exec ... which works on Windows import os, sys, subprocess def runPyPyTests(pythonExe, rootDir, args): command = [pythonExe, r"py\bin\py.test"] + list(args) print 'Walking', repr(rootDir) for rootDir, dirs, files in os.walk(rootDir): print 'Found', repr(rootDir), repr(dirs), repr(files) if "test" in dirs: testDir = os.path.join(rootDir, "test") print 'Running', repr(command + [testDir]) subprocess.call(command + [testDir]) def main(): runPyPyTests(sys.argv[1], sys.argv[2], sys.argv[3:]) if __name__ == '__main__': main()