From 437e222407b326c01d8a4ba20d7ff385ea69d281 Mon Sep 17 00:00:00 2001 From: Taiwo Olori <101744737+OloriT@users.noreply.github.com> Date: Sat, 18 Nov 2023 06:34:25 +0000 Subject: [PATCH 1/2] changed test_add to fail --- .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..1a7ee7fb 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) == 0 + + +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 2aaeaf451e2849bec0419df2f3d1fdc97326507d Mon Sep 17 00:00:00 2001 From: Taiwo Olori <101744737+OloriT@users.noreply.github.com> Date: Sat, 18 Nov 2023 07:43:36 +0100 Subject: [PATCH 2/2] 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 1a7ee7fb..efdc7a33 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(): @@ -14,4 +14,4 @@ def test_mul(): def test_div(): - assert div(2, 1) == 2 \ No newline at end of file + assert div(2, 1) == 2