From 7e59e8f2134cbf68a3781070c47813dca58776c3 Mon Sep 17 00:00:00 2001 From: samaelrv Date: Wed, 14 Jun 2023 22:09:51 +0530 Subject: [PATCH 1/3] test coverage added --- .github/workflows/ci_cd_wf.yml | 29 +++++++++++++++++++++++++++++ tests/test_calculator.py | 13 +++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/ci_cd_wf.yml diff --git a/.github/workflows/ci_cd_wf.yml b/.github/workflows/ci_cd_wf.yml new file mode 100644 index 00000000..978bc8a4 --- /dev/null +++ b/.github/workflows/ci_cd_wf.yml @@ -0,0 +1,29 @@ +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.9" + + - name: Install Dependencies + run: | + python -m pip install -r requirements.txt + - name: Run tests + run: | + python -m pytest -v tests diff --git a/tests/test_calculator.py b/tests/test_calculator.py index e69de29b..26376a76 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -0,0 +1,13 @@ +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 \ No newline at end of file From 42ea46ea5bd10bad0612f7e7dc147ea97fdf2693 Mon Sep 17 00:00:00 2001 From: Ramanath Naik <88053906+samaelrv@users.noreply.github.com> Date: Wed, 14 Jun 2023 22:19:33 +0530 Subject: [PATCH 2/3] Update test_calculator.py --- tests/test_calculator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 26376a76..d6413a69 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,7 +1,7 @@ from calculator import add, div, mul, sub def test_add(): - assert add(1, 1) == 2 + assert add(1, 1) == 0 def test_sub(): assert sub(1, 1) == 0 @@ -10,4 +10,4 @@ def test_mul(): assert mul(1, 1) == 1 def test_div(): - assert div(2, 1) == 2 \ No newline at end of file + assert div(2, 1) == 2 From b0b1bfc0a0633d56cd26b1a5b5945cd2666f6506 Mon Sep 17 00:00:00 2001 From: Ramanath Naik <88053906+samaelrv@users.noreply.github.com> Date: Wed, 14 Jun 2023 22:25:38 +0530 Subject: [PATCH 3/3] Update test_calculator.py --- tests/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_calculator.py b/tests/test_calculator.py index d6413a69..3fd0c371 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,7 +1,7 @@ from calculator import add, div, mul, sub def test_add(): - assert add(1, 1) == 0 + assert add(1, 1) == 2 def test_sub(): assert sub(1, 1) == 0