From 8e852bf2dd80b08ffa8a6999fcdb66301804269f Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 12:57:40 +0000 Subject: [PATCH 1/8] Wrong test added --- .github/workflows/ci_cd_wf.yml | 29 +++++++++++++++++++++++++++++ tests/test_calculator.py | 17 +++++++++++++++++ 2 files changed, 46 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..8ca03d4c --- /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.x" + + - name: Install Dependencies + run: | + python -m pip install -r requirements.txt + - name: Run tests + run: | + python -m pytest -v tests \ No newline at end of file diff --git a/tests/test_calculator.py b/tests/test_calculator.py index e69de29b..8cf7002b 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -0,0 +1,17 @@ +from calculator import add, div, mul, sub + + +def test_add(): + assert add(1, 1) + + +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 2b99bfe9f3b7f777bd8099bee6cc0d0449daad1f Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:04:53 +0000 Subject: [PATCH 2/8] right one added --- 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 8cf7002b..fa3dc440 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -2,7 +2,7 @@ def test_add(): - assert add(1, 1) + assert add(1, 1)==2 def test_sub(): From e23ea661f83c217ca9c94de46784e7362755d8e7 Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:14:46 +0000 Subject: [PATCH 3/8] added wronng logic --- 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 fa3dc440..34a90bdf 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -2,7 +2,7 @@ def test_add(): - assert add(1, 1)==2 + assert add(1, 1)==0 def test_sub(): From d1eb31abc85ab56c7ef96477737bcc9109530db2 Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:17:03 +0000 Subject: [PATCH 4/8] added right logic --- 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 34a90bdf..fa3dc440 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -2,7 +2,7 @@ def test_add(): - assert add(1, 1)==0 + assert add(1, 1)==2 def test_sub(): From 1d69a83af2919ded01c22d608882ffe852e17307 Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:33:36 +0000 Subject: [PATCH 5/8] added pytest coverage --- .github/workflows/ci_cd_wf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_wf.yml b/.github/workflows/ci_cd_wf.yml index 8ca03d4c..e8fc0528 100644 --- a/.github/workflows/ci_cd_wf.yml +++ b/.github/workflows/ci_cd_wf.yml @@ -26,4 +26,4 @@ jobs: python -m pip install -r requirements.txt - name: Run tests run: | - python -m pytest -v tests \ No newline at end of file + python -m pytest --cov=tests \ No newline at end of file From 4005a1d3bfa282567a143468783c2f904fd4a811 Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:46:09 +0000 Subject: [PATCH 6/8] try1 --- .github/workflows/ci_cd_wf.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_wf.yml b/.github/workflows/ci_cd_wf.yml index e8fc0528..b459993b 100644 --- a/.github/workflows/ci_cd_wf.yml +++ b/.github/workflows/ci_cd_wf.yml @@ -26,4 +26,6 @@ jobs: python -m pip install -r requirements.txt - name: Run tests run: | - python -m pytest --cov=tests \ No newline at end of file + python -m pytest -v tests --cov=tests + - name: Test coverage + \ No newline at end of file From 9369eb75f6f20befd7c898571d6c3d746eab94dc Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:50:42 +0000 Subject: [PATCH 7/8] try2 --- .github/workflows/ci_cd_wf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_wf.yml b/.github/workflows/ci_cd_wf.yml index b459993b..e3b6681a 100644 --- a/.github/workflows/ci_cd_wf.yml +++ b/.github/workflows/ci_cd_wf.yml @@ -27,5 +27,5 @@ jobs: - name: Run tests run: | python -m pytest -v tests --cov=tests - - name: Test coverage + \ No newline at end of file From 08a73c17054e8cf97b65f9c031b56daed57edeed Mon Sep 17 00:00:00 2001 From: Abhinav Sharma <64996545+Abhi007-glitch@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:53:51 +0000 Subject: [PATCH 8/8] reverted --- .github/workflows/ci_cd_wf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_wf.yml b/.github/workflows/ci_cd_wf.yml index e3b6681a..8a437da0 100644 --- a/.github/workflows/ci_cd_wf.yml +++ b/.github/workflows/ci_cd_wf.yml @@ -26,6 +26,6 @@ jobs: python -m pip install -r requirements.txt - name: Run tests run: | - python -m pytest -v tests --cov=tests + python -m pytest -v tests \ No newline at end of file