HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //proc/1233/root/home/arjun/projects/buyercall_forms/buyercall/cli/commands/cmd_coverage.py
import logging
import subprocess

import click

try:
    from instance import settings

    APP_ROOT = settings.APP_ROOT
except ImportError:
    logging.error('Ensure __init__.py and settings.py both exist in instance/')
    exit(1)
except AttributeError:
    from config import settings

    APP_ROOT = settings.APP_ROOT

PACKAGE_PATH = '{0}/{1}'.format(APP_ROOT, '/buyercall')


@click.command()
@click.argument('path', default=PACKAGE_PATH)
def cli(path):
    """
    Run test coverage report.

    :return: Subprocess call result
    """
    cmd = 'py.test --cov-report term-missing --cov {0} {0}'.format(path)
    return subprocess.call(cmd, shell=True)