From 5bfd579452c244a8ffcd432ad5ad7825b81e5c4a Mon Sep 17 00:00:00 2001 From: Carlos Z <50459069+carlosug@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:27:59 +0200 Subject: [PATCH 1/2] unable automated testing --- .github/workflows/python-app.yml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..ed88dc2 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,46 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + pull-requests: write + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest pytest-cov + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest and calculate coverage + run: | + pytest --cov-report "xml:coverage.xml" --cov=. + - name: Create Coverage + if: ${{ github.event_name == 'pull_request' }} + uses: orgoro/coverage@v3 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} From 99cf185fc7cdebfc2450a2561c17510ddc24a8e4 Mon Sep 17 00:00:00 2001 From: carlosug Date: Wed, 13 Sep 2023 11:33:17 +0200 Subject: [PATCH 2/2] added step 5 --- __pycache__/functions.cpython-310.pyc | Bin 0 -> 677 bytes .../test_functions.cpython-310-pytest-7.3.1.pyc | Bin 0 -> 1286 bytes test_functions.py | 14 +++++++------- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 __pycache__/functions.cpython-310.pyc create mode 100644 __pycache__/test_functions.cpython-310-pytest-7.3.1.pyc diff --git a/__pycache__/functions.cpython-310.pyc b/__pycache__/functions.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70f67ed321a69a6d78e2870c590d95b922f610a6 GIT binary patch literal 677 zcmah`J4*vW5Z>Lpm`gN}La-7nY_8Dz1EPZ31|{00376Z=W#L}zLkt8g;-ATX(a!2x zD{DKkaAreHn&80BV`uNXZ@wuzoi+ixd#2(Y;s+L+#-O-_qmRLH!s!bc5YD&JwQQk*e6pvWRY{_sjmx zQ=C_sh{m=^u%l0_Y3;?FQ>2GH1FDea))^GORQPhq+5gMj2u&#KK--Z~abgxPCG;uJ0yIzgfjhh_(E7g)!^+9bystEAqPpzeS#N z0zJ{TXDTx!M7g5akvxo~a+89|IA;?NtJ_hQ?olp-QMk)#x=Ujj$SjB`6LBFT-Qj#S z0JtD8K*R_58-h#VRbq*zXo`=F(jaDOPK~Mg(I~B{C04|oc=viQszXV#oy()ecIK&4Gw(wy2c2JFZNRJ&7WhL7+e zOwdB577Sv5Sfxo?z_xvfZRZl(@6h32Y)i=3Y!5ZF|I8M_33j(n^aVLFwX#8Z_|zB< zJ$$fnXE~p&d!qIE3@ig&P46TX#C1_Nb_JdCJsiQPE&o0X%X*Q^?<)@DADRLCIY>S_>$j0K$L zJj#+hw1z9{Ux=y7ge?lDGN;@kN;0 zY0-ZVqY?cmD#nH6F=OGlp#7IwR3tQ&kjM%ysI~;ikK&Z_Nnej8PR9^T!DfYc5T}xk zdBwc{dh)K$Z|#Rk&S+I0jEXeUKPGzlM7i}~32}ggut5F9zc9b94{|}d=VRqv2&h{@ zeGt8R7SN-|=_ejb80tkxHO^wZ4d3|9i|wkzM^ literal 0 HcmV?d00001 diff --git a/test_functions.py b/test_functions.py index ffd7a65..8835b7b 100644 --- a/test_functions.py +++ b/test_functions.py @@ -8,12 +8,12 @@ def test_add(): assert add("space", "ship") == "spaceship" -# def test_subtract(): -# assert subtract(3,2) == 1 +def test_subtract(): + assert subtract(3,2) == 1 -# def test_convert_fahrenheit_to_celsius(): -# assert f2c(32) == 0 -# assert f2c(122) == pytest.approx(50) -# with pytest.raises(AssertionError): -# f2c(-600) +def test_convert_fahrenheit_to_celsius(): + assert f2c(32) == 0 + assert f2c(122) == pytest.approx(50) + with pytest.raises(AssertionError): + f2c(-600)