From 29bab75eb5bf9395a6563dd8d13744e92564550f Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Wed, 28 Aug 2024 12:13:57 +0200 Subject: [PATCH] add pytest Workflow --- .github/workflows/pytest.yml | 51 ++++++++++++++++++++++++++++++++++++ requirements-test.txt | 7 ++--- requirements.txt | 2 +- 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..d544e97 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -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 diff --git a/requirements-test.txt b/requirements-test.txt index c03d801..60a8409 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -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 \ No newline at end of file +pytest==8.3.2 +pytest-asyncio==0.24.0 diff --git a/requirements.txt b/requirements.txt index c63ace9..f0e224b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ netifaces aiohttp urllib3 -tenacity \ No newline at end of file +tenacity