Skip to content

Commit

Permalink
add pytest Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrike committed Aug 28, 2024
1 parent 2debda5 commit 29bab75
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test Python package

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
**/pyproject.toml
**/requirements*.txt
- run: pip install -e . -r requirements-test.txt

- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: >
${{ format('pre-commit-{0}-{1}',
steps.setup-python.outputs.python-version,
hashFiles('.pre-commit-config.yaml')
) }}
- name: Install pre-commit
run: |
pip install --upgrade pip
pip install pre-commit
pre-commit install
- name: Run pre-commit hooks
run: >
git ls-files | xargs pre-commit run
--show-diff-on-failure
--color=always
--files
- name: Test with pytest
run: |
pytest tests
7 changes: 2 additions & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
black==24.2.0
flake8==7.0.0
isort==v5.10.1
pylint==3.0.3
freezegun==1.5.1
aresponses==3.0.0
pytest==8.3.2
pytest-asyncio==0.24.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
netifaces
aiohttp
urllib3
tenacity
tenacity

0 comments on commit 29bab75

Please sign in to comment.