From 4cdacec199dd3938d6af2413b55ad2d889b8e883 Mon Sep 17 00:00:00 2001 From: Philipp Schlegel Date: Thu, 5 Sep 2024 22:45:57 +0100 Subject: [PATCH] CI: avoid subprocesses for testing tutorials --- tests/test_tutorials.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/test_tutorials.py b/tests/test_tutorials.py index 61eeb7ab..533cfb56 100644 --- a/tests/test_tutorials.py +++ b/tests/test_tutorials.py @@ -13,8 +13,10 @@ Set `capture_output=True` to see the error message. - the MICrONS tutorial occasionally fails because the CAVE backend throws an error (e.g. during the materialization) + - Github runners appear to have 4 CPUs - so should be good to go """ +import os import subprocess from pathlib import Path @@ -36,14 +38,19 @@ continue print(f"Executing {file.name} [{i+1}/{len(files)}]... ", end="", flush=True) - try: - # Set `capture_output=True` to see e.g. error messages. - p = subprocess.run(["python", str(file)], check=True, capture_output=True, timeout=600, cwd=file.parent) - except subprocess.CalledProcessError as e: - print("Failed!") - print(e.stdout.decode()) - print(e.stderr.decode()) - raise + os.chdir(file.parent) + exec(open(file.name).read()) print("Done.", flush=True) + # print(f"Executing {file.name} [{i+1}/{len(files)}]... ", end="", flush=True) + # try: + # # Set `capture_output=True` to see e.g. error messages. + # p = subprocess.run(["python", str(file)], check=True, capture_output=True, timeout=600, cwd=file.parent) + # except subprocess.CalledProcessError as e: + # print("Failed!") + # print(e.stdout.decode()) + # print(e.stderr.decode()) + # raise + # print("Done.", flush=True) + print("All done.")