Skip to content

Commit

Permalink
undo all debug stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sroet committed Aug 19, 2024
1 parent 4ba5eda commit 9c89c20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/tutorial-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ name: Test Tutorial
on:
push:
branches:
# - main
- sroet-patch-1
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"
schedule:
# Weekly on saturday 23:59
- cron: "59 23 * * 6"


jobs:
Expand Down Expand Up @@ -45,9 +49,6 @@ jobs:
run: echo "TQDM_MININTERVAL=10" >> "$GITHUB_ENV"
- name: Run Tutorial test
run: |
# DEBUG; TODO REMOVE
ls -l dataset/*
# Hardcode the conversion line
for x in dataset/*.mrc; do python -c "import mrcfile; mrc = mrcfile.mmap('$x', 'r+'); mrc.voxel_size = 13.79"; done
python -u tests/test_tutorial.py
12 changes: 6 additions & 6 deletions docs/tutorials/tests/test_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import subprocess
from mdextractor import extract_md_blocks


def sanitize_block(block):
block = block.split()
out = [i for i in block if i and i != '\\']
out = [i for i in block if i and i != "\\"]
return out


print("Doing tutorial tests")
lines = "".join(open("Tutorial.md").readlines())
blocks = extract_md_blocks(lines)
Expand All @@ -16,17 +18,15 @@ def sanitize_block(block):
raise ValueError("Did not find any code blocks")
for block in blocks:
# strip out extra typing
block = block.strip('bash')
# DEBUG: TODO: REMOVE
print(f"{block.split()=}")
block = block.strip("bash")
if block.split()[0].endswith(".py"):
print(f"Running: {block}")

block = sanitize_block(block)
outfile = None
# Deal with stdout redirect
# Deal with stdout redirect
if block[-2] == ">":
outfile = open(block[-1], 'a+')
outfile = open(block[-1], "a+")
block = block[:-2]
# Check=True makes sure this code returns early
subprocess.run(block, check=True, stdout=outfile)
Expand Down

0 comments on commit 9c89c20

Please sign in to comment.