From 2dbed119b8d2379fbda8d90488c3c4d59b409410 Mon Sep 17 00:00:00 2001 From: abdul Date: Fri, 8 Mar 2024 11:31:57 +0100 Subject: [PATCH] I use pytest package as my test runner and add CI workflow --- .github/workflows/workflow.yml | 25 +++++++++++++++++++++++++ requirements.txt | 6 +++--- setup.cfg | 11 ++++------- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index e69de29..020d6bc 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -0,0 +1,25 @@ +name: CI Workflow + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + container: python:3.9-slim + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install dependecies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + - name: Lint with flake8 + run: | + flake8 service --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 service --count --max-complexity=10 --max-line-length=127 --statistics + - name: Run unit test with pytest + run: python -m pytest \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 32b733e..8d4505b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,9 +15,9 @@ flake8==4.0.1 black==22.3.0 # Testing dependencies -nose==1.3.7 -pinocchio==0.4.3 -coverage==6.3.2 +pytest==7.4.3 +pytest-cov==4.1.0 +coverage==7.1.0 # Utilities httpie==3.2.1 diff --git a/setup.cfg b/setup.cfg index 2785829..6e573c4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,7 @@ -[nosetests] -verbosity=2 -with-spec=1 -spec-color=1 -with-coverage=1 -cover-erase=1 -cover-package=service +[tool:pytest] +addopts = -vv --disable-warnings --cov=service.routes + + # cover-xml=1 # cover-xml-file=./coverage.xml # with-xunit=1