Commit b2b5a62f authored by adrian_egli2's avatar adrian_egli2
Browse files

Examples cleaned up

- unused imports removed
- removed unused code

are no ready for benchmarking
parent b83b4269
Pipeline #11463 passed with stages
in 29 minutes and 16 seconds
......@@ -9,7 +9,7 @@ from importlib_resources import path
from benchmarks.benchmark_utils import swap_attr
print("run_all_examples.py")
error_log_examples = {}
for entry in [entry for entry in importlib_resources.contents('examples') if
not pkg_resources.resource_isdir('examples', entry)
and entry.endswith(".py")
......@@ -17,6 +17,7 @@ for entry in [entry for entry in importlib_resources.contents('examples') if
and 'demo.py' not in entry
and 'DELETE' not in entry
]:
with path('examples', entry) as file_in:
print("")
print("")
......@@ -25,6 +26,7 @@ for entry in [entry for entry in importlib_resources.contents('examples') if
print("*****************************************************************")
print("Running {}".format(entry))
print("*****************************************************************")
with swap_attr(sys, "stdin", StringIO("q")):
try:
runpy.run_path(file_in, run_name="__main__", init_globals={
......@@ -32,5 +34,17 @@ for entry in [entry for entry in importlib_resources.contents('examples') if
})
except Exception as e:
print(e)
error_log_examples.update({file_in: e})
print("runpy done.")
print("Done with {}".format(entry))
if len(error_log_examples.keys()) > 0:
print("*****************************************************************")
print("Error log:")
print("*****************************************************************")
print(error_log_examples)
print("*****************************************************************")
else:
print("*****************************************************************")
print("All examples executed - no error.")
print("*****************************************************************")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment