v0.165.0
 1import os
 2import sys
 3
 4import click
 5from plain.cli import register_cli
 6from plain.cli.runtime import common_command
 7
 8
 9@common_command
10@register_cli("test")
11@click.command(
12    context_settings={
13        "ignore_unknown_options": True,
14    }
15)
16@click.argument("pytest_args", nargs=-1, type=click.UNPROCESSED)
17def cli(pytest_args: tuple[str, ...]) -> None:
18    """Test suite with pytest"""
19    # .env.test loading is handled by the pytest plugin in plugin.py
20
21    cmd = [
22        sys.executable,
23        "-m",
24        "pytest",
25        *pytest_args,
26    ]
27
28    # Replace current process with pytest
29    os.execvp(cmd[0], cmd)