Updated test cases documentation

This commit is contained in:
Bartek Kryza
2023-09-10 12:22:27 +02:00
parent 4a19c8ba23
commit bf29ceb2df
351 changed files with 34009 additions and 5201 deletions

View File

@@ -20,12 +20,28 @@
import sys
import subprocess
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
def print_usage():
print(f'Usage: ./generate_mermaid.py file1.mmd file2.mmd ...')
def generate_mermaid_diagram(f):
try:
print(f'Generating Mermaid diagram from {f}')
f_svg = Path(f).with_suffix('.svg').name
target = Path(f).parent.absolute()
target = target.joinpath('mermaid')
target = target.joinpath(f_svg)
subprocess.check_call(['mmdc', '-i', f, '-o', target])
except subprocess.CalledProcessError:
print(f'ERROR: Generating Mermaid diagram from {f} failed')
return False
return True
files = sys.argv[1:]
@@ -35,16 +51,9 @@ if not files:
ok = 0
for f in files:
try:
print(f'Generating Mermaid diagram from {f}')
f_svg = Path(f).with_suffix('.svg').name
target = Path(f).parent.absolute()
target = target.joinpath('mermaid')
target = target.joinpath(f_svg)
subprocess.check_call(['mmdc', '-i', f, '-o', target])
except subprocess.CalledProcessError:
ok = 1
print(f'ERROR: Generating Mermaid diagram from {f} failed')
with ThreadPoolExecutor(max_workers=10) as executor:
result = all(executor.map(generate_mermaid_diagram, files))
sys.exit(ok)