diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9084994..13f5fddc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,13 +3,14 @@ on: [push, pull_request] jobs: run: runs-on: ubuntu-latest + steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - set-safe-directory: true + fetch-depth: 0 - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies @@ -17,4 +18,8 @@ jobs: - name: Run tests and collect coverage run: pytest --cov app - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4-beta + with: + verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c18dd8d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..c341b2a0 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Codecov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/app/__pycache__/__init__.cpython-39.pyc b/app/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index d38e9303..00000000 Binary files a/app/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/app/__pycache__/calculator.cpython-39.pyc b/app/__pycache__/calculator.cpython-39.pyc deleted file mode 100644 index a39eb26f..00000000 Binary files a/app/__pycache__/calculator.cpython-39.pyc and /dev/null differ diff --git a/app/__pycache__/test_calculator.cpython-39-pytest-7.1.1.pyc b/app/__pycache__/test_calculator.cpython-39-pytest-7.1.1.pyc deleted file mode 100644 index 7e1f15b7..00000000 Binary files a/app/__pycache__/test_calculator.cpython-39-pytest-7.1.1.pyc and /dev/null differ diff --git a/app/test_calculator.py b/app/test_calculator.py index f5641938..329905fe 100644 --- a/app/test_calculator.py +++ b/app/test_calculator.py @@ -15,17 +15,3 @@ def test_subtract(): assert Calculator.subtract(0, 2.0) == -2.0 assert Calculator.subtract(2.0, 0.0) == 2.0 assert Calculator.subtract(-4, 2.0) == -6.0 - -def test_multiply(): - assert Calculator.multiply(1, 2) == 2.0 - assert Calculator.multiply(1.0, 2.0) == 2.0 - assert Calculator.multiply(0, 2.0) == 0.0 - assert Calculator.multiply(2.0, 0.0) == 0.0 - assert Calculator.multiply(-4, 2.0) == -8.0 - -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(2.0, 0.0) == 'Cannot divide by 0' diff --git a/codecov.yml b/codecov.yml index 6f151f75..1ed5513f 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,13 @@ -profiling: - critical_files_paths: - - app/calculator.py +flag_management: + individual_flags: + - name: smart-tests + carryforward: true + carryforward_mode: "labels" + statuses: + - type: "project" + - type: "patch" -comment: - show_critical_paths: true +cli: + plugins: + pycoverage: + report_type: "json" diff --git a/requirements.txt b/requirements.txt index c011c2e5..9037410e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ -attrs==21.4.0 -coverage==6.4.1 -iniconfig==1.1.1 -packaging==21.3 -pluggy==1.0.0 +attrs==23.2.0 +coverage==7.4.0 +iniconfig==2.0.0 +packaging==23.2 +pluggy==1.3.0 py==1.11.0 -pyparsing==3.0.9 -pytest==7.1.2 -pytest-cov==3.0.0 +pyparsing==3.1.1 +pytest==7.4.4 +pytest-cov==4.1.0 tomli==2.0.1 diff --git a/tests.py b/tests.py deleted file mode 100644 index 6503da36..00000000 --- a/tests.py +++ /dev/null @@ -1,18 +0,0 @@ -import unittest - -import awesome - - -class TestMethods(unittest.TestCase): - def test_add(self): - self.assertEqual(awesome.smile(), ":)") - - def test_add_again(self): - self.assertEqual(awesome.smile(), ":)") - - def test_if(self): - self.assertTrue(awesome.test_if(1)) - - -if __name__ == '__main__': - unittest.main()