Skip to content

Commit

Permalink
CI: avoid subprocesses for testing tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Sep 5, 2024
1 parent d03d8ff commit 4cdacec
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tests/test_tutorials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.")

0 comments on commit 4cdacec

Please sign in to comment.