From e665e2390d79b82a213d29ddf62902e8ec263995 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 10:04:32 +0530 Subject: [PATCH 01/17] change return message --- app/calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/calculator.py b/app/calculator.py index 4f380e8e..72698e4a 100644 --- a/app/calculator.py +++ b/app/calculator.py @@ -11,6 +11,6 @@ def multiply(x, y): def divide(x, y): if y == 0: - return 'Cannot divide by 0' + return 'Unable to divide by 0' return x * 1.0 / y From 6fbf267c34b3f0b90d2c4766b2d1215a22a165b9 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 10:18:32 +0530 Subject: [PATCH 02/17] adding TA upload steps to workflow --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15abf468..003168ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Install dependencies run: pip install -r requirements.txt - name: Run tests and collect coverage - run: pytest --cov app + run: pytest --cov --junitxml=junit.xml -o junit_family=legacy app - name: Upload coverage to Codecov (arg token) uses: codecov/codecov-action@main with: @@ -40,3 +40,8 @@ jobs: fail_ci_if_error: true use_oidc: true verbose: true + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} From 7882e5d3a29b65b7abf6b310ffe2d7229cf4080d Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 11:03:05 +0530 Subject: [PATCH 03/17] upload test results before coverage --- .github/workflows/ci.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 003168ba..c7cc6bca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,11 @@ jobs: run: pip install -r requirements.txt - name: Run tests and collect coverage run: pytest --cov --junitxml=junit.xml -o junit_family=legacy app + -name : Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} - name: Upload coverage to Codecov (arg token) uses: codecov/codecov-action@main with: @@ -40,8 +45,8 @@ jobs: fail_ci_if_error: true use_oidc: true verbose: true - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} + #- name: Upload test results to Codecov + # if: ${{ !cancelled() }} + #uses: codecov/test-results-action@v1 + #with: + #token: ${{ secrets.CODECOV_TOKEN }} From 7e162c8cbf93eaae012b28ef2a3d0b194ca9f78c Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 11:08:20 +0530 Subject: [PATCH 04/17] typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7cc6bca..de00c20f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: run: pip install -r requirements.txt - name: Run tests and collect coverage run: pytest --cov --junitxml=junit.xml -o junit_family=legacy app - -name : Upload test results to Codecov + - name : Uploading test results to Codecov if: ${{ !cancelled() }} uses: codecov/test-results-action@v1 with: From 73f74a2d4fe6429612711f089c06d0213b9cf97a Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 11:20:29 +0530 Subject: [PATCH 05/17] failing tests --- app/test_calculator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index f5641938..39d4097b 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -3,7 +3,7 @@ def test_add(): assert Calculator.add(1, 2) == 3.0 - assert Calculator.add(1.0, 2.0) == 3.0 + assert Calculator.add(1.0, 1.0) == 3.0 assert Calculator.add(0, 2.0) == 2.0 assert Calculator.add(2.0, 0) == 2.0 assert Calculator.add(-4, 2.0) == -2.0 @@ -24,8 +24,8 @@ def test_multiply(): assert Calculator.multiply(-4, 2.0) == -8.0 def test_divide(): - # assert Calculator.divide(1, 2) == 0.5 + assert Calculator.divide(1, 2) == 0.5 assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 assert Calculator.divide(-4, 2.0) == -2.0 - # assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' + assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' From eae35bb16a98961e5684a78aca7f9d09d7f83d32 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 11:31:15 +0530 Subject: [PATCH 06/17] fixing tests --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index 39d4097b..62a63906 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -3,7 +3,7 @@ def test_add(): assert Calculator.add(1, 2) == 3.0 - assert Calculator.add(1.0, 1.0) == 3.0 + assert Calculator.add(1.0, 2.0) == 3.0 assert Calculator.add(0, 2.0) == 2.0 assert Calculator.add(2.0, 0) == 2.0 assert Calculator.add(-4, 2.0) == -2.0 From bcfac82ba83ae4d1e2d3c693fab07ab24d1d9d94 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 11:39:38 +0530 Subject: [PATCH 07/17] fixing my test --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index 62a63906..43bc650e 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -28,4 +28,4 @@ def test_divide(): assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 assert Calculator.divide(-4, 2.0) == -2.0 - assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' + # assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' From 6709261b7368e9090543d72ee4a938fdb8aff9dc Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 12:12:47 +0530 Subject: [PATCH 08/17] failing test_divide --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index 43bc650e..62a63906 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -28,4 +28,4 @@ def test_divide(): assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 assert Calculator.divide(-4, 2.0) == -2.0 - # assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' + assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' From 9a127ead0e759167aeaa04e1afedb1a962348225 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 15:33:49 +0530 Subject: [PATCH 09/17] failing a test --- app/test_calculator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index 62a63906..af593173 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -3,7 +3,7 @@ def test_add(): assert Calculator.add(1, 2) == 3.0 - assert Calculator.add(1.0, 2.0) == 3.0 + assert Calculator.add(1.0, 1.0) == 3.0 assert Calculator.add(0, 2.0) == 2.0 assert Calculator.add(2.0, 0) == 2.0 assert Calculator.add(-4, 2.0) == -2.0 @@ -28,4 +28,4 @@ def test_divide(): assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 assert Calculator.divide(-4, 2.0) == -2.0 - assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' + # assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' \ No newline at end of file From dd12b20a7e8c6557473bf5f736906bcd581f2075 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 15:37:20 +0530 Subject: [PATCH 10/17] fixing test --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index af593173..662f61a9 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -3,7 +3,7 @@ def test_add(): assert Calculator.add(1, 2) == 3.0 - assert Calculator.add(1.0, 1.0) == 3.0 + assert Calculator.add(1.0, 2.0) == 3.0 assert Calculator.add(0, 2.0) == 2.0 assert Calculator.add(2.0, 0) == 2.0 assert Calculator.add(-4, 2.0) == -2.0 From 56415e8971c0960f06c8a958b84840b4650a1508 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 15:55:32 +0530 Subject: [PATCH 11/17] changed tests --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index 662f61a9..af593173 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -3,7 +3,7 @@ def test_add(): assert Calculator.add(1, 2) == 3.0 - assert Calculator.add(1.0, 2.0) == 3.0 + assert Calculator.add(1.0, 1.0) == 3.0 assert Calculator.add(0, 2.0) == 2.0 assert Calculator.add(2.0, 0) == 2.0 assert Calculator.add(-4, 2.0) == -2.0 From aa21074d12866bb9f60e412a11efb2d589ab544b Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 15:58:10 +0530 Subject: [PATCH 12/17] adding a flaky test --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index af593173..f121815a 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -3,7 +3,7 @@ def test_add(): assert Calculator.add(1, 2) == 3.0 - assert Calculator.add(1.0, 1.0) == 3.0 + assert Calculator.add(1.0, 0.0) == 3.0 assert Calculator.add(0, 2.0) == 2.0 assert Calculator.add(2.0, 0) == 2.0 assert Calculator.add(-4, 2.0) == -2.0 From e5d4bfc1ea08c4e34cc692100d403e9841ac1a8d Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 16:07:14 +0530 Subject: [PATCH 13/17] fixed failing test --- app/test_calculator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index f121815a..d6736b12 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -3,7 +3,7 @@ def test_add(): assert Calculator.add(1, 2) == 3.0 - assert Calculator.add(1.0, 0.0) == 3.0 + assert Calculator.add(1.0, 1.0) == 2.0 assert Calculator.add(0, 2.0) == 2.0 assert Calculator.add(2.0, 0) == 2.0 assert Calculator.add(-4, 2.0) == -2.0 @@ -28,4 +28,4 @@ def test_divide(): assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 assert Calculator.divide(-4, 2.0) == -2.0 - # assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' \ No newline at end of file + assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' \ No newline at end of file From 628c2d4c88aeb6fed9b686e7858054468966d2b1 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 16:39:38 +0530 Subject: [PATCH 14/17] checking some tests --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index d6736b12..30102437 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -27,5 +27,5 @@ def test_divide(): assert Calculator.divide(1, 2) == 0.5 assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 - assert Calculator.divide(-4, 2.0) == -2.0 + # assert Calculator.divide(-4, 2.0) == -2.0 assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' \ No newline at end of file From 010093910c02278dedec66d48c03f43a05439557 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 16:46:26 +0530 Subject: [PATCH 15/17] reducing # of codecov uplaods --- .github/workflows/ci.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de00c20f..e20854cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,24 +27,24 @@ jobs: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} verbose: true - - name: Upload coverage to Codecov (env token) - uses: codecov/codecov-action@main - with: - fail_ci_if_error: true - verbose: true - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - name: Upload coverage to Codecov (no token) - uses: codecov/codecov-action@main - with: - fail_ci_if_error: true - verbose: true - - name: Upload coverage to Codecov (oidc) - uses: codecov/codecov-action@main - with: - fail_ci_if_error: true - use_oidc: true - verbose: true + #- name: Upload coverage to Codecov (env token) + #uses: codecov/codecov-action@main + #with: + # fail_ci_if_error: true + #verbose: true + #env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + #- name: Upload coverage to Codecov (no token) + #uses: codecov/codecov-action@main + #with: + # fail_ci_if_error: true + #verbose: true + #- name: Upload coverage to Codecov (oidc) + # uses: codecov/codecov-action@main + #with: + # fail_ci_if_error: true + #use_oidc: true + #verbose: true #- name: Upload test results to Codecov # if: ${{ !cancelled() }} #uses: codecov/test-results-action@v1 From cb19885aa5a8f71b997dbce8396e687ec4514584 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 16:48:38 +0530 Subject: [PATCH 16/17] resetting flake count --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index 30102437..d6736b12 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -27,5 +27,5 @@ def test_divide(): assert Calculator.divide(1, 2) == 0.5 assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 - # assert Calculator.divide(-4, 2.0) == -2.0 + assert Calculator.divide(-4, 2.0) == -2.0 assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' \ No newline at end of file From cbd563dd9b0300f0fa57b36c0eb4a232205f6b76 Mon Sep 17 00:00:00 2001 From: Rohan Bhaumik Date: Thu, 19 Dec 2024 16:49:42 +0530 Subject: [PATCH 17/17] attempt 2 --- app/test_calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test_calculator.py b/app/test_calculator.py index d6736b12..e9513f43 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -28,4 +28,4 @@ def test_divide(): assert Calculator.divide(1.0, 2.0) == 0.5 assert Calculator.divide(0, 2.0) == 0 assert Calculator.divide(-4, 2.0) == -2.0 - assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' \ No newline at end of file + # assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0' \ No newline at end of file