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 9509c7e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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"]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: 'pyproject.toml' # Read python version from a file pyproject.toml
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
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
continue-on-error: true
run: >
git ls-files | xargs pre-commit run
--show-diff-on-failure
--color=always
--files
- name: Test with pytest
continue-on-error: true
run: |
pytest tests
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ script-files = ['bin/pydaikin']

[tool.black]
skip-string-normalization = true
target-version = ["py311"]
target-version = ["py311", "py312", "py313"]
include = '\.pyi?$|pydaikin$'
exclude = '''
/(
Expand Down
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 9509c7e

Please sign in to comment.