def runAllInDir(dir_path, exclude=[], add_args=(), ignoreErrors=True):
print('<STR_LIT>' % dir_path)<EOL>if type(add_args) in (tuple, list):<EOL><INDENT>sys.argv.extend(add_args)<EOL><DEDENT>else:<EOL><INDENT>sys.argv.append(add_args)<EOL><DEDENT>t = <NUM_LIT:0><EOL>failed = []<EOL>for _, modname, ispkg in pkgutil.walk_packages(<EOL>[dir_path],<EOL>):<EOL><INDENT>if not ispkg and modname != thismodname and modname not in exclude:  <EOL><INDENT>print('<STR_LIT>' % modname)<EOL>t0 = time()<EOL>try:<EOL><INDENT>runpy.run_module(<EOL>modname,<EOL>init_globals=None,<EOL>run_name='<STR_LIT:__main__>',<EOL>alter_sys=False)<EOL><DEDENT>except Exception as err:<EOL><INDENT>if ignoreErrors:<EOL><INDENT>print("<STR_LIT>" % err)<EOL><DEDENT>else:<EOL><INDENT>raise err<EOL><DEDENT>failed.append((modname, err))<EOL><DEDENT>dt = time() - t0<EOL>t += dt<EOL>print('<STR_LIT>' % dt)<EOL><DEDENT><DEDENT>print('<STR_LIT>')<EOL>print('<STR_LIT>' % t)<EOL>if failed:<EOL><INDENT>print('<STR_LIT>')<EOL>print('<STR_LIT>' % len(failed))<EOL>print('<STR_LIT>')<EOL>for mod, err in failed:<EOL><INDENT>print(mod, err)<EOL><DEDENT><DEDENT>
execute all modules as __main__ within a given package path