Skip to content

Commit

Permalink
test: added coverage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ted Fulk committed Nov 9, 2023
1 parent 78b8deb commit e0e47bf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install flake8 pytest pytest-cov
- 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: Run tests with pytest and measure coverage
run: |
pytest --cov=./ --cov-report html
4 changes: 2 additions & 2 deletions py_do_you_even_diff_bro/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import List, Optional

from pydantic import BaseModel, Field, validator
from pydantic import BaseModel, Field, field_validator

from py_do_you_even_diff_bro.utils import StrEnum

Expand All @@ -16,7 +16,7 @@ class BugBase(BaseModel):
bug_id: str
description: str

@validator("bug_id")
@field_validator("bug_id")
def validate_bug_id(cls, v):
if not v.startswith("B") or not v[1:].isdigit():
raise ValueError("bug_id must start with B followed by numbers")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pytest = "^7.4.3"
pydantic = "^2.4.2"
typer = {extras = ["all"], version = "^0.9.0"}
pytest-mock = "^3.12.0"
pytest-cov = "^4.1.0"



Expand Down
Empty file added tests/test_coverage.py
Empty file.

0 comments on commit e0e47bf

Please sign in to comment.