Skip to content

Commit

Permalink
add automatic testing
Browse files Browse the repository at this point in the history
  • Loading branch information
afairless committed Apr 18, 2024
1 parent c7d53b7 commit a706508
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Run Unit Tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest poetry
poetry install
- 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: |
poetry run python -m pytest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/output/
/output02/
/src/step05_api/log_config.json

# https://github.com/github/gitignore/blob/main/Python.gitignore
#################################################
Expand Down
2 changes: 1 addition & 1 deletion src/step05_api/log_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"level": "INFO",
"class": "logging.FileHandler",
"formatter": "default",
"filename": "/home/username/Documents/weather_api.log",
"filename": "/home/gv/Documents/weather_api.log",
"mode": "a",
"encoding": "utf-8"
}
Expand Down

0 comments on commit a706508

Please sign in to comment.