Skip to content

Commit ad174d5

Browse files
pco2699loganek
authored andcommitted
feature: add support for wizard engine
1 parent 7dad5f1 commit ad174d5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

adapters/wizard.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import argparse
2+
import subprocess
3+
import sys
4+
import os
5+
import shlex
6+
7+
# shlex.split() splits according to shell quoting rules
8+
WIZARD = shlex.split(os.getenv("TEST_RUNTIME_EXE", "wizeng.x86-64-linux"))
9+
10+
parser = argparse.ArgumentParser()
11+
parser.add_argument("--version", action="store_true")
12+
parser.add_argument("--test-file", action="store")
13+
parser.add_argument("--arg", action="append", default=[])
14+
parser.add_argument("--env", action="append", default=[])
15+
parser.add_argument("--dir", action="append", default=[])
16+
17+
args = parser.parse_args()
18+
19+
if args.version:
20+
# ensure no args when version is queried
21+
subprocess.run(WIZARD[0:1] + ["-version"])
22+
sys.exit(0)
23+
24+
TEST_FILE = args.test_file
25+
PROG_ARGS = args.arg
26+
ENV_ARGS = None if len(args.env) == 0 else f'--env={",".join(args.env)}'
27+
DIR_ARGS = None if len(args.dir) == 0 else f'--dir={",".join(args.dir)}'
28+
29+
r = subprocess.run([arg for arg in WIZARD + [ENV_ARGS, DIR_ARGS, TEST_FILE] + PROG_ARGS if arg])
30+
sys.exit(r.returncode)

0 commit comments

Comments
 (0)