diff --git a/benchmarks/run_all_examples.py b/benchmarks/run_all_examples.py index 9b85b24c3f423a890fca11f23a8ca6fcd296ab43..d27182294abb003191b53dd3517a12793cb8f659 100644 --- a/benchmarks/run_all_examples.py +++ b/benchmarks/run_all_examples.py @@ -1,30 +1,30 @@ import runpy -# import sys -# from io import StringIO -# -# import importlib_resources -# import pkg_resources -# from importlib_resources import path -# -# from benchmarks.benchmark_utils import swap_attr +import sys +from io import StringIO + +import importlib_resources +import pkg_resources +from importlib_resources import path + +from benchmarks.benchmark_utils import swap_attr print("GRRRRRRRR run_all_examples.py") -# for entry in [entry for entry in importlib_resources.contents('examples') if -# not pkg_resources.resource_isdir('examples', entry) -# and entry.endswith(".py") -# and '__init__' not in entry -# and 'demo.py' not in entry -# and 'DELETE' not in entry -# ]: -# with path('examples', entry) as file_in: -# print("") -# print("") -# -# print("") -# print("*****************************************************************") -# print("Running {}".format(entry)) -# print("*****************************************************************") +for entry in [entry for entry in importlib_resources.contents('examples') if + not pkg_resources.resource_isdir('examples', entry) + and entry.endswith(".py") + and '__init__' not in entry + and 'demo.py' not in entry + and 'DELETE' not in entry + ]: + with path('examples', entry) as file_in: + print("") + print("") + + print("") + print("*****************************************************************") + print("Running {}".format(entry)) + print("*****************************************************************") # with swap_attr(sys, "stdin", StringIO("q")): # try: # runpy.run_path(file_in, run_name="__main__", init_globals={