From 11e82c83283cc666ca60c1c9da48e93b5c82522c Mon Sep 17 00:00:00 2001 From: "Md. Ashrafull Islam" <121140781+md-ashrafull-islam@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:48:55 +0000 Subject: [PATCH 1/4] test --- .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..3763f12c 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 6f51784aac894467eba6b157aeb417881101398b Mon Sep 17 00:00:00 2001 From: "Md. Ashrafull Islam" <121140781+md-ashrafull-islam@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:56:47 +0000 Subject: [PATCH 2/4] test --- .vscode/settings.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9b388533 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file From d385b580e34b7046a6814cf7583d77bc08f86b7c Mon Sep 17 00:00:00 2001 From: "Md. Ashrafull Islam" <121140781+md-ashrafull-islam@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:06:54 +0000 Subject: [PATCH 3/4] test commits --- tests/test_calculator.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 3763f12c..35c990f1 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -4,14 +4,11 @@ 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 09fc1fbbaf92c8e91c89a761414fee43735c3028 Mon Sep 17 00:00:00 2001 From: "Md. Ashrafull Islam" <121140781+md-ashrafull-islam@users.noreply.github.com> Date: Thu, 15 Jun 2023 01:18:09 +0600 Subject: [PATCH 4/4] 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 35c990f1..96ff63e0 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(): assert sub(1, 1) == 0 @@ -11,4 +11,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