From e6318f344655c43f224fba3fe7c0884d091e153d Mon Sep 17 00:00:00 2001 From: Jon Grace-Cox Date: Mon, 30 Dec 2024 08:25:01 -0500 Subject: [PATCH] test: Add tox testing Add `tox.ini` config with supported versions, and a new tox CI workflow to run tox tests on master branch changes. This is "expensive" so we may consider limiting execution further. --- .github/workflows/tox.yaml | 32 ++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 9 +++++++++ README.md | 2 +- build-requirements.txt | 1 + tox.ini | 9 +++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tox.yaml create mode 100644 tox.ini diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml new file mode 100644 index 0000000..2b653e3 --- /dev/null +++ b/.github/workflows/tox.yaml @@ -0,0 +1,32 @@ +name: Run Tox Tests + +on: + push: + branches: + - master # Run only on the master branch + +jobs: + test: + name: Test with Tox + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install tox + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Run Tox + run: tox -e py${{ matrix.python-version }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3744d0b..cbdec69 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -216,6 +216,15 @@ inv package.build && inv package.install && inv test.cli Note that this will force install the built wheel from the project `dist/` directory over any existing local install. +### Tox tests + +To run tox tests against all supported Python versions: + +```bash +pip install tox +tox +``` + ## Documentation The `README.md` file contains a table showing example badges for the different built-in colors. If you modify the diff --git a/README.md b/README.md index fcf9e18..6bcad2b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Python project for generating badges for your projects [![buymeacoffee](https://camo.githubusercontent.com/c3f856bacd5b09669157ed4774f80fb9d8622dd45ce8fdf2990d3552db99bd27/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://www.buymeacoffee.com/jongracecox) -Supports: Python 3.7-3.9 (2.7-3.6 support has been dropped) +Supports: Python 3.7-3.13 (2.7-3.6 support has been dropped) ## Overview diff --git a/build-requirements.txt b/build-requirements.txt index 2c5f7dc..ea058e3 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -5,5 +5,6 @@ pytest pytest-cov requests setuptools +tox types-requests wheel diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..97b5e93 --- /dev/null +++ b/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py37, py38, py39, py310, py311, py312, py313 + +[testenv] +deps = + pytest + -rbuild-requirements.txt +commands = + pytest --doctest-modules anybadge tests