Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

PyTest and Flake8

PyTest and Flake8 #22

Workflow file for this run

name: Python Testing
run-name: PyTest and Flake8
on:
workflow_dispatch:
workflow_call:
push:
paths:
- 'tests/**'
- 'simpletool/**'
- 'setup.py'
jobs:
### TEST ######################################################
test:
environment: staging
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
env:
TEST_STATUS: 'nok'
PYPI_NAME: 'simpletool'
steps:
- name:
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest>=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 pytest-xdist flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pytest --cov=simpletool --cov-report=term-missing --cov-report=html tests/
- name: Final, set Test Status = OK
run: echo "TEST_STATUS=ok" >> $GITHUB_ENV
outputs:
TEST_STATUS: ${{ env.TEST_STATUS }}