Coverage for /Users/davegaeddert/Developer/dropseed/plain/plain-pytest/plain/pytest/cli.py: 57%
14 statements
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-23 11:16 -0600
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-23 11:16 -0600
1import os
2import sys
4import click
5from dotenv import load_dotenv
7import pytest
10@click.command(
11 context_settings={
12 "ignore_unknown_options": True,
13 }
14)
15@click.argument("pytest_args", nargs=-1, type=click.UNPROCESSED)
16def cli(pytest_args):
17 """Run tests with pytest"""
19 if os.path.exists(".env.test"):
20 click.secho("Loading environment variables from .env.test", fg="yellow")
21 load_dotenv(".env.test")
23 returncode = pytest.main(list(pytest_args))
24 if returncode:
25 sys.exit(returncode)