Skip to content

refactor: Add unit testing and refactor code to follow Python standards. #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run tests

on:
pull_request:
push:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- 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
pip install ruff pytest
cd src/ && pip install -r requirements.txt
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
ruff --select=E9,F63,F7,F82 --target-version=py37 .
# default set of ruff rules with GitHub Annotations
ruff --target-version=py37 .
- name: Test with pytest
run: |
pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ local.properties
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
Expand Down Expand Up @@ -223,3 +224,4 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.gitignore.io/api/osx,java,linux,eclipse,windows,netbeans,java-web,intellij
__pycache__/
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,26 @@ repos:
rev: v2.12.0
hooks:
- id: hadolint-docker
- repo: 'https://github.com/charliermarsh/ruff-pre-commit'
rev: v0.2.0
hooks:
- id: ruff
args:
- '--line-length=120'
- '--fix'
- '--exit-non-zero-on-fix'
- repo: 'https://github.com/pycqa/isort'
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args:
- '--profile'
- black
- '--filter-files'
- repo: 'https://github.com/psf/black'
rev: 24.1.1
hooks:
- id: black
args:
- '--line-length=120'
Empty file added src/app/__init__.py
Empty file.
Loading
Loading