Skip to content

Commit

Permalink
fix: Use pipx to run tox in CI template
Browse files Browse the repository at this point in the history
Plus some related cleanup. Poetry still needs to be installed before running `pipx run tox ...` because tox is configured to use poetry from the external environment, rather than installing it into the tox venv.

Supersedes:
- #1476

Closes #1481
  • Loading branch information
WillDaSilva committed Mar 5, 2023
1 parent c52d1cb commit 537df02
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,43 @@ on: [push]

jobs:
linting:

runs-on: ubuntu-latest
strategy:
matrix:
# Only lint using the primary version used for dev
python-version: [3.9]

python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python {{ '${{ matrix.python-version }}' }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry==1.2.*
- name: Install dependencies
- name: Install pipx and Poetry
run: |
poetry install
pip install pipx poetry
- name: Run lint command from tox.ini
run: |
poetry run tox -e lint
pipx run tox -e lint

pytest:

runs-on: ubuntu-latest
env:
GITHUB_TOKEN: {{ '${{secrets.GITHUB_TOKEN}}' }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]

python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python {{ '${{ matrix.python-version }}' }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry==1.2.*
pip install poetry
- name: Install dependencies
run: |
poetry install
- name: Test with pytest
run: |
poetry run pytest --capture=no
poetry run pytest
6 changes: 2 additions & 4 deletions cookiecutter/tap-template/{{cookiecutter.tap_id}}/tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# This file can be used to customize tox tests as well as other test frameworks like flake8 and mypy

[tox]
envlist = py38
; envlist = py37, py38, py39
envlist = py39
isolated_build = true

[testenv]
allowlist_externals = poetry

commands =
poetry install -v
poetry run pytest
Expand All @@ -19,7 +17,7 @@ commands =
[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
envlist = py37, py38, py39
envlist = py37, py38, py39, py310, py311
commands =
poetry install -v
poetry run pytest
Expand Down

0 comments on commit 537df02

Please sign in to comment.