#!python

import os
import sys
import json

args = json.loads(sys.argv[1])

collect_only = bool(args.get("collect-only", False))
files = args.get("files", [])
nodeids = args.get("nodeids", [])

# Create the command line to launch
cmd = ["pytest", "--litf", "--fulltrace"]

if collect_only:
    cmd.append("--collectonly")

if files:
    cmd.extend(files)
elif nodeids:
    cmd.extend(nodeids)

# Replace current process with the cmd
os.execvp("pytest", cmd)
