diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15abf468..e20854cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,28 +15,38 @@ jobs: - name: Install dependencies run: pip install -r requirements.txt - name: Run tests and collect coverage - run: pytest --cov app - - name: Upload coverage to Codecov (arg token) - uses: codecov/codecov-action@main + run: pytest --cov --junitxml=junit.xml -o junit_family=legacy app + - name : Uploading test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 with: - 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) + - name: Upload coverage to Codecov (arg token) uses: codecov/codecov-action@main with: fail_ci_if_error: true - use_oidc: 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 test results to Codecov + # if: ${{ !cancelled() }} + #uses: codecov/test-results-action@v1 + #with: + #token: ${{ secrets.CODECOV_TOKEN }} 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 diff --git a/app/test_calculator.py b/app/test_calculator.py index f5641938..e9513f43 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) == 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 @@ -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' \ No newline at end of file