Merge pull request #54 from YunoHost-Apps/dev

Add "coverage" command
This commit is contained in:
Jens Diemer 2024-08-02 19:57:10 +02:00 committed by GitHub
commit 4da7bd28e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 6 deletions

View file

@ -39,6 +39,7 @@ Usage: ./dev-cli.py [OPTIONS] COMMAND [ARGS]...
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ check-code-style Check code style by calling darker + flake8 │
│ coverage Run tests and show coverage report. │
│ diffsettings Run "diffsettings" manage command against a "local_test" YunoHost │
│ installation. │
│ fix-code-style Fix code style of all your_cool_package source code files via darker │

View file

@ -1,24 +1,21 @@
"""
CLI for development
"""
import logging
import shlex
import sys
from pathlib import Path
import for_runners_ynh
import rich_click as click
from cli_base.cli_tools import code_style
from cli_base.cli_tools.dev_tools import run_tox
from cli_base.cli_tools.dev_tools import run_coverage, run_tox
from cli_base.cli_tools.subprocess_utils import verbose_check_call
from cli_base.cli_tools.test_utils.snapshot import UpdateTestSnapshotFiles
from cli_base.cli_tools.verbosity import OPTION_KWARGS_VERBOSE
from cli_base.cli_tools.version_info import print_version
from cli_base.run_pip_audit import run_pip_audit
from django.core.management.commands.test import Command as DjangoTestCommand
from for_runners_ynh import constants
from for_runners_ynh.constants import PACKAGE_ROOT
from for_runners_ynh.tests import setup_ynh_tests
from django_yunohost_integration.local_test import create_local_test
from manageprojects.utilities.publish import publish_package
from rich import print
@ -26,6 +23,11 @@ from rich.console import Console
from rich.traceback import install as rich_traceback_install
from rich_click import RichGroup
import for_runners_ynh
from for_runners_ynh import constants
from for_runners_ynh.constants import PACKAGE_ROOT
from for_runners_ynh.tests import setup_ynh_tests
logger = logging.getLogger(__name__)
@ -211,6 +213,14 @@ def test():
_run_django_test_cli(argv=sys.argv, exit_after_run=True)
@cli.command() # Dummy command
def coverage():
"""
Run tests and show coverage report.
"""
run_coverage()
@cli.command() # Dummy "tox" command
def tox():
"""
@ -273,6 +283,7 @@ def main():
command_map = {
'test': _run_django_test_cli,
'tox': run_tox,
'coverage': run_coverage,
}
if real_func := command_map.get(command):
real_func(argv=sys.argv, exit_after_run=True)

View file

@ -19,7 +19,7 @@ code = "https://github.com/jedie/django-for-runners"
[integration]
# https://yunohost.org/en/packaging_manifest#integration-section
yunohost = ">=11"
yunohost = ">=11.2"
architectures = "all"
multi_instance = true
ldap = true