Skip to content

Commit

Permalink
chore: Modernize tox setup
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Oct 14, 2024
1 parent e7d4b2d commit c52891b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 51 deletions.
37 changes: 9 additions & 28 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,21 @@ jobs:
linting:

runs-on: ubuntu-latest
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
steps:
- uses: actions/checkout@v4
- name: Install Poetry
run: |
pipx install poetry
poetry --version
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: 3.x
cache: poetry
- name: Install dependencies
run: |
poetry env use ${{ steps.setup-python.outputs.python-path }}
poetry install
- uses: astral-sh/setup-uv@v3
with:
version: ">=0.4.20"
- name: Run lint command from tox.ini
run: |
pipx run tox -e lint
uvx tox -e lint
pytest:

runs-on: ubuntu-latest
env:
CLIENT_SECRETS: ${{ secrets.GA_CLIENT_SECRETS }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
strategy:
matrix:
python-version:
Expand All @@ -72,19 +58,14 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install Poetry
run: |
pipx install poetry
poetry --version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: poetry
- name: Install dependencies
run: |
poetry install
- uses: astral-sh/setup-uv@v3
with:
version: ">=0.4.20"
- name: Test with pytest
run: |
poetry run pytest --capture=no
uvx tox -e py
2 changes: 0 additions & 2 deletions .github/workflows/constraints.txt

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ Create tests within the `tap_csv/tests` subfolder and
then run:

```bash
poetry run tox
poetry run tox -e pytest
poetry run tox -e py313
poetry run tox -e format
poetry run tox -e lint
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ruff = ">=0.1.15"
types-requests = ">=2.31.0"

[build-system]
requires = ["poetry-core==1.9.0"]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
Expand Down
34 changes: 16 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
# 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 = py3{8,9,10,11,12,13}, format, lint
isolated_build = true

[testenv]
allowlist_externals = poetry

[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
envlist = py38, py39, py310, py311, py312
deps =
coverage
pytest
commands =
poetry install -v
poetry run coverage run -m pytest
poetry run coverage html -d tap_csv/tests/codecoverage
coverage run -m pytest
coverage html -d tap_csv/tests/codecoverage

[testenv:format]
# Attempt to auto-resolve lint errors before they are raised.
# To execute, run `tox -e format`
deps =
ruff
commands =
poetry install -v
poetry run ruff check --fix tap_csv/
poetry run ruff format tap_csv
ruff check --fix tap_csv/
ruff format tap_csv

[testenv:lint]
# Raise an error if lint and style standards are not met.
# To execute, run `tox -e lint`
deps =
ruff
mypy
commands =
poetry install -v
poetry run ruff check --diff tap_csv/
poetry run ruff format --check tap_csv
poetry run mypy tap_csv --exclude='tap_csv/tests' --ignore-missing-imports
ruff check --diff tap_csv/
ruff format --check tap_csv
mypy tap_csv --exclude='tap_csv/tests' --ignore-missing-imports

0 comments on commit c52891b

Please sign in to comment.