Skip to content

Commit 425d5dc

Browse files
committed
add pytest Workflow
1 parent 2debda5 commit 425d5dc

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

.github/workflows/pytest.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Test Python package
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
python-version: ["3.11", "3.12", "3.13"]
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
cache: "pip"
22+
cache-dependency-path: |
23+
**/pyproject.toml
24+
**/requirements*.txt
25+
- run: pip install -e . -r requirements-test.txt
26+
27+
- uses: actions/cache@v4
28+
with:
29+
path: ~/.cache/pre-commit
30+
key: >
31+
${{ format('pre-commit-{0}-{1}',
32+
steps.setup-python.outputs.python-version,
33+
hashFiles('.pre-commit-config.yaml')
34+
) }}
35+
36+
- name: Install pre-commit
37+
run: |
38+
pip install --upgrade pip
39+
pip install pre-commit
40+
pre-commit install
41+
42+
- name: Run pre-commit hooks
43+
run: >
44+
git ls-files | xargs pre-commit run
45+
--show-diff-on-failure
46+
--color=always
47+
--files
48+
49+
- name: Test with pytest
50+
run: |
51+
pytest tests

requirements-test.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
black==24.2.0
2-
flake8==7.0.0
3-
isort==v5.10.1
4-
pylint==3.0.3
51
freezegun==1.5.1
6-
aresponses==3.0.0
2+
pytest==8.3.2
3+
pytest-asyncio==0.24.0

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
netifaces
22
aiohttp
33
urllib3
4-
tenacity
4+
tenacity

0 commit comments

Comments
 (0)