Skip to content

Commit

Permalink
sanitize input to subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
sroet authored Aug 16, 2024
1 parent e07addb commit 0e9cfc0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/tutorials/tests/test_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
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 != '\\']
return out

print("Doing tutorial tests")
lines = "".join(open("Tutorial.md").readlines())
blocks = extract_md_blocks(lines)
Expand All @@ -16,4 +21,4 @@
print(f"{block.split()=}")
if block.split()[0].endswith(".py"):
print(f"Running: {block}")
subprocess.run(block)
subprocess.run(sanitize_block(block))

0 comments on commit 0e9cfc0

Please sign in to comment.