Skip to content
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 #99

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
44 changes: 44 additions & 0 deletions .github/workflows/ci_cd_wf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: test

on:
push:
branches:
- main
pull_request:
branches:
- "*"

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out repo code
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.x"

- name: Install Dependencies
run: |
python -m pip install -r requirements.txt
- name: Run tests
run: |
python -m pytest -v tests

- name: Install Py-test Cov Reports
run: |
python -m pip install pytest-cov

- name: Install pytest-cov for report
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml

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

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