From 3488f3cd6004e1db39637520393c5a68b211e377 Mon Sep 17 00:00:00 2001 From: Mark Beacom <7315957+mbeacom@users.noreply.github.com> Date: Sun, 9 Jul 2023 00:11:41 -0400 Subject: [PATCH] Adjust coverage scope and add no argument test case --- README.md | 5 +++++ pyproject.toml | 7 +++++++ tests/test_cli.py | 12 +++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 56be8d6..7fe1c22 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # python-template +[![Validation Workflow](https://github.com/mbeacom/python-template/actions/workflows/validate.yaml/badge.svg?branch=main&event=push)](https://github.com/mbeacom/python-template/actions/workflows/validate.yaml) +[![Pre-Commit Checks Workflow](https://github.com/mbeacom/python-template/actions/workflows/pre-commit.yaml/badge.svg?branch=main&event=push)](https://github.com/mbeacom/python-template/actions/workflows/pre-commit.yaml) +[![Coverage Status](https://codecov.io/github/mbeacom/python-template/coverage.svg?branch=main)](https://codecov.io/github/mbeacom/python-template?branch=main) +[![PyPi](https://img.shields.io/pypi/v/python-template-x)](https://pypi.org/project/python-template-x/) + This project is an opinionated python template. ## Usage diff --git a/pyproject.toml b/pyproject.toml index dc96a2e..fd92f76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,6 +128,13 @@ target-version = "py311" "FBT", # Ignore booleans as positional arguments in tests, e.g., @pytest.mark.parametrize() ] +[tool.coverage.run] +omit = [ + "*/tests/*", + "*/__init__.py", + "*/__main__.py", +] + [tool.poe.tasks] isort = "isort --profile=black ." black = "black ." diff --git a/tests/test_cli.py b/tests/test_cli.py index abe63b3..a5c93fa 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -9,14 +9,20 @@ def test_entry_version_arg() -> None: - """Test the entry method with version argument.""" + """Test the entry method with the version argument.""" result = runner.invoke(app, ["--version"]) assert result.exit_code == 0 assert "python-template version" in result.stdout -def test_entry_no_arg() -> None: - """Test the entry method with no arguments.""" +def test_entry_help() -> None: + """Test the entry method with the help argument.""" result = runner.invoke(app, ["--help"]) assert result.exit_code == 0 assert "OPTIONS" in result.stdout + + +def test_entry_no_arg() -> None: + """Test the entry method with no arguments.""" + result = runner.invoke(app, []) + assert result.exit_code == 0