From b958a61069c1bdc027c2e7988b1725a72832d3fc Mon Sep 17 00:00:00 2001 From: MikesRND <6515522+MikesRND@users.noreply.github.com> Date: Sun, 27 Jul 2025 17:49:27 -0400 Subject: [PATCH] Add coverage (and fix badges) --- .github/workflows/tox.yml | 9 +++++++++ LICENSE.txt => LICENSE | 0 README.md | 3 ++- pyproject.toml | 14 +++++++++++++- tox.ini | 6 ++++-- 5 files changed, 28 insertions(+), 4 deletions(-) rename LICENSE.txt => LICENSE (100%) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index e9c65bf..0614893 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -29,3 +29,12 @@ jobs: - name: "Run tox targets for ${{ matrix.python-version }}" run: "tox" + + - name: "Upload coverage to Codecov" + if: matrix.python-version == '3.12' + uses: codecov/codecov-action@v5 + with: + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/README.md b/README.md index 1f8f10f..b91d71e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ ![chainfix](https://github.com/pydefi/chainfix/raw/main/docs/logo/chainfix_logo.png) [![CI](https://github.com/pydefi/chainfix/actions/workflows/tox.yml/badge.svg)](https://github.com/pydefi/chainfix/actions/workflows/tox.yml) +[![codecov](https://codecov.io/gh/pydefi/chainfix/branch/main/graph/badge.svg)](https://codecov.io/gh/pydefi/chainfix) [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://github.com/pydefi/chainfix) -[![License](https://img.shields.io/github/license/pydefi/chainfix)](https://github.com/pydefi/chainfix/blob/main/LICENSE.txt) +[![License](https://img.shields.io/github/license/pydefi/chainfix)](https://github.com/pydefi/chainfix/blob/main/LICENSE) Chainfix provides a way to represent numbers and perform simple math operations using fixed-point data types. diff --git a/pyproject.toml b/pyproject.toml index 8c27ba9..cbd83a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ dynamic = ["version"] authors = [{name = "PyDefi Development Team", email = "MikesRND@users.noreply.github.com"}] description = "Fixed-point data types for signal processing and blockchain applications" readme = "README.md" -license = {file = "LICENSE.txt"} +license = {file = "LICENSE"} requires-python = ">=3.8" classifiers = [ "Development Status :: 3 - Alpha", @@ -40,3 +40,15 @@ where = ["src"] [tool.setuptools.dynamic] version = {attr = "chainfix.__version__"} + +[tool.coverage.run] +source = ["src"] +branch = true + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "if TYPE_CHECKING:", + "raise NotImplementedError", +] diff --git a/tox.ini b/tox.ini index 9a212fe..5ee04ec 100644 --- a/tox.ini +++ b/tox.ini @@ -3,8 +3,10 @@ isolated_build = true envlist = py38, py39, py310, py311, py312, py313 [testenv] -deps = pytest -commands = pytest +deps = + pytest + pytest-cov +commands = pytest --cov=chainfix --cov-report=xml --cov-report=term-missing [gh-actions] python =