From b0c76ac5b918866f2f44514c57e4eb94dc593a34 Mon Sep 17 00:00:00 2001 From: jhhoyosb <122836146+jhhoyosb@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:26:01 -0500 Subject: [PATCH 1/4] Create python-app.yml --- .github/workflows/python-app.yml | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 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..8c80a1a --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,45 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + permissions: + contents: read + pull-requests: write + + 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 7aa893fa6b10842c4705609f3bc0fc659de62534 Mon Sep 17 00:00:00 2001 From: jhhoyosb <122836146+jhhoyosb@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:30:35 -0500 Subject: [PATCH 2/4] test --- __pycache__/functions.cpython-311.pyc | Bin 0 -> 760 bytes .../test_functions.cpython-311-pytest-7.2.1.pyc | Bin 0 -> 2603 bytes test_functions.py | 14 +++++++------- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 __pycache__/functions.cpython-311.pyc create mode 100644 __pycache__/test_functions.cpython-311-pytest-7.2.1.pyc diff --git a/__pycache__/functions.cpython-311.pyc b/__pycache__/functions.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..709291801ac7719e8f910242d68b722a6b8ce802 GIT binary patch literal 760 zcma)3OG_g`5U!qyOLPp&YK|(o4#?&bZ;N|c5R@Rqlb0|~w`P{fOt!mc*(^Ea;6Z|LFWv&Vi3h7X4<8G=ThL$EtE;NNI?d%~04037=RLgd$QTP7DT5_c zI>2Ecwt+K5#w|pP+lV&LRKT6`t?@IwNw@I~W)V8jf)@LYS_QhS+=Z@{GB0I2iqZ;& zN4Hpu>!SGG3lKM(TSDm|+WYp)t2aVX+)W~12XUl6H=3#KaW1Fv8O=6u5ZZ9#%pUwW zTxo9%(1ib+L(+6ILokIfnnY$%PqQl7(bDs^%%MqPNgPS)_Rs2=UV*<>uP31n8evm@ z#Cr6VSJlUiqZdBlF&wU<(gFP{rpZ5&7H;GOi9Db1&#kvMZpSV^6fl49@`B{)t81C= z=7TOvXLh}s6j4nCT2Y(AkcdS;j(!TMt1scIj;p>1Rgfq-kD0`fT0m&StuueLcD#Ky zcb#AE<(JRIwNvUjrK?QIFjsanW^tzHusanP?trK@Js-1Q>M>73u`2WEqhZuKLf>YL X^)1Fe^BnhV{^EFkn6TA}FF4{$OqWhNQ)LQcx^Aa1;{Pvp^v1+T5(h4T$BvKcdQx((oOL=eF->R~w=i5VCeC05VI!ehj>q~5D1PR~giy@s@zU~Bf4 zB*yV_Z<$zsphBgD%%*1@d2#quv{0K7{r{IV`FSS zleUR9wiqu&oLSq|Tmrs6CbnSrjRSbfA#~M9t*Dn6p7?K#7o}&SSepl4Insc zTHD8B8y|~ZaV$2Si_eU$Ef?=^-nf;I9=NRe#|*4*tqXM5Ww*q*;j-J(aNlKabF#jr z+?y_=BA9D)6Uahr2ytJC2SRM_ulkI^(IsbhyDsBaKI(S4&2m2oxy1%i&Kpt@&~3i~(hB*zgB=>2^m%;7r3?n!pQ^sp?1`Ni(_1GXA#za!Rr*XF9 z$6o3uA#Zrh?}s7+UwI_+iL&%Dr5WW{y?#a$zwpAnJoZz+0FPVeOX3MC_3pfKZ(jL+ zUio2Od8krUp}Ti0+6EJco;61=q9uS=}GujVYkTqG!_o~t-o z1+TJz)W$`NrU6hi#kr&kG{savO9%xRLY<4IGttb?fKwODoR7xFr(8Mt$T7KO~|17NvL AHUIzs literal 0 HcmV?d00001 diff --git a/test_functions.py b/test_functions.py index ffd7a65..88fd496 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) From cc32eeb36d4cca1bb1ce5102a90bab3e3f4bb11c Mon Sep 17 00:00:00 2001 From: jhhoyosb <122836146+jhhoyosb@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:41:28 -0500 Subject: [PATCH 3/4] Update test_functions.py --- test_functions.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test_functions.py b/test_functions.py index 88fd496..f31f126 100644 --- a/test_functions.py +++ b/test_functions.py @@ -12,8 +12,4 @@ 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) + From 99ab27c3bc338cf8c96b70c14eeb78f7c831c09a Mon Sep 17 00:00:00 2001 From: jhhoyosb <122836146+jhhoyosb@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:43:59 -0500 Subject: [PATCH 4/4] Update test_functions.py --- test_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_functions.py b/test_functions.py index f31f126..c54f132 100644 --- a/test_functions.py +++ b/test_functions.py @@ -4,7 +4,7 @@ def test_add(): - assert add(2, 3) == 5 + assert add(2, 4) == 6 assert add("space", "ship") == "spaceship"