Skip to content
9 changes: 9 additions & 0 deletions .github/workflows/ci_cd_wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ jobs:
- name: Run tests
run: |
python -m pytest -v tests

- name: Build coverage file
run: |
pytest --cov-report=term-missing:skip-covered --cov=. | tee pytest-coverage.txt

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ packaging==23.1
pluggy==1.0.0
pytest==7.3.1
tomli==2.0.1
pytest-cov
Empty file added tests/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions tests/test_calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from calculator import add, div, mul, sub


def test_add():
assert add(1, 1) == 2


def test_sub():
assert sub(1, 1) == 0


def test_mul():
assert mul(1, 1) == 1


def test_div():
assert div(2, 1) == 2