From 9c89c20f80ad71a7181bd8c867bd496dd83d8a4d Mon Sep 17 00:00:00 2001 From: Sander Roet Date: Mon, 19 Aug 2024 11:57:42 +0200 Subject: [PATCH] undo all debug stuff --- .github/workflows/tutorial-tests.yml | 11 ++++++----- docs/tutorials/tests/test_tutorial.py | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tutorial-tests.yml b/.github/workflows/tutorial-tests.yml index e2226ac..89b62f8 100644 --- a/.github/workflows/tutorial-tests.yml +++ b/.github/workflows/tutorial-tests.yml @@ -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: @@ -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 diff --git a/docs/tutorials/tests/test_tutorial.py b/docs/tutorials/tests/test_tutorial.py index 455eb0e..f675567 100644 --- a/docs/tutorials/tests/test_tutorial.py +++ b/docs/tutorials/tests/test_tutorial.py @@ -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) @@ -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)