Skip to content
Snippets Groups Projects
Commit eaaa06ed authored by u214892's avatar u214892
Browse files

#163 random guesses

parent 7bda56da
No related branches found
No related tags found
No related merge requests found
import runpy import runpy
import sys # import sys
from io import StringIO # from io import StringIO
#
# import importlib_resources
# import pkg_resources
# from importlib_resources import path
#
# from benchmarks.benchmark_utils import swap_attr
import importlib_resources print("GRRRRRRRR run_all_examples.py")
import pkg_resources
from importlib_resources import path
from benchmarks.benchmark_utils import swap_attr # for entry in [entry for entry in importlib_resources.contents('examples') if
# not pkg_resources.resource_isdir('examples', entry)
print("run_all_examples.py") # and entry.endswith(".py")
# and '__init__' not in entry
for entry in [entry for entry in importlib_resources.contents('examples') if # and 'demo.py' not in entry
not pkg_resources.resource_isdir('examples', entry) # and 'DELETE' not in entry
and entry.endswith(".py") # ]:
and '__init__' not in entry # with path('examples', entry) as file_in:
and 'demo.py' not in entry # print("")
and 'DELETE' not in entry # print("")
]: #
with path('examples', entry) as file_in: # print("")
print("") # print("*****************************************************************")
print("") # print("Running {}".format(entry))
# print("*****************************************************************")
print("") # with swap_attr(sys, "stdin", StringIO("q")):
print("*****************************************************************") # try:
print("Running {}".format(entry)) # runpy.run_path(file_in, run_name="__main__", init_globals={
print("*****************************************************************") # 'argv': ['--sleep-for-animation=False']
with swap_attr(sys, "stdin", StringIO("q")): # })
try: # except Exception as e:
runpy.run_path(file_in, run_name="__main__", init_globals={ # print(e)
'argv': ['--sleep-for-animation=False'] # print("runpy done.")
}) # print("Done with {}".format(entry))
except Exception as e:
print(e)
print("runpy done.")
print("Done with {}".format(entry))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment