From 47fed1b5eecf77ff700bcf3fdb4fa4d1b90532ac Mon Sep 17 00:00:00 2001 From: avi bahra <58593365+avi369@users.noreply.github.com> Date: Tue, 15 Sep 2020 10:51:34 +0100 Subject: [PATCH 01/11] Create python-app.yml --- .github/workflows/python-app.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 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..c7f5067 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + 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 + run: | + pytest From 1a91a9fb2d8048668dfcf5e9d360792918df9ec5 Mon Sep 17 00:00:00 2001 From: avi bahra <58593365+avi369@users.noreply.github.com> Date: Tue, 15 Sep 2020 10:56:32 +0100 Subject: [PATCH 02/11] Update python-app.yml --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index c7f5067..830defb 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -33,4 +33,4 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest + pytest test From 96973ecb8d77641cf5e1d3b440bcb7614fbe0282 Mon Sep 17 00:00:00 2001 From: avi bahra Date: Tue, 15 Sep 2020 11:08:31 +0100 Subject: [PATCH 03/11] fix --- tests/test_useful_things.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_useful_things.py b/tests/test_useful_things.py index 07ee740..3a946a4 100644 --- a/tests/test_useful_things.py +++ b/tests/test_useful_things.py @@ -2,7 +2,6 @@ from hypothesis import given import hypothesis.strategies as st - @given(st.integers(), st.integers()) def test_add(x, y): assert useful_things.add(x, y) == x + y From 7f304b689cd006b744c8c30d14c11ed853d83e4a Mon Sep 17 00:00:00 2001 From: avi bahra <58593365+avi369@users.noreply.github.com> Date: Tue, 15 Sep 2020 11:12:55 +0100 Subject: [PATCH 04/11] Update python-app.yml --- .github/workflows/python-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 830defb..b227c9e 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -7,7 +7,7 @@ on: push: branches: [ master ] pull_request: - branches: [ master ] + branches: [ avi369-path-1 ] jobs: build: @@ -33,4 +33,4 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest test + pytest From c6843c6afdc1cdaf43b88116920c5d599e6bc05d Mon Sep 17 00:00:00 2001 From: avi bahra <58593365+avi369@users.noreply.github.com> Date: Tue, 15 Sep 2020 11:13:21 +0100 Subject: [PATCH 05/11] Update python-app.yml --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index b227c9e..afa7227 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -7,7 +7,7 @@ on: push: branches: [ master ] pull_request: - branches: [ avi369-path-1 ] + branches: [ avi369-patch-1 ] jobs: build: From 62952f09ef18a0aba174e1ea27da8300892df39d Mon Sep 17 00:00:00 2001 From: avi bahra Date: Tue, 15 Sep 2020 11:29:04 +0100 Subject: [PATCH 06/11] fix2 --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index afa7227..c7f5067 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -7,7 +7,7 @@ on: push: branches: [ master ] pull_request: - branches: [ avi369-patch-1 ] + branches: [ master ] jobs: build: From 688a0037256cd5a186efb190ba226fc19ed11dbe Mon Sep 17 00:00:00 2001 From: avi bahra Date: Tue, 15 Sep 2020 11:34:06 +0100 Subject: [PATCH 07/11] fix4 --- tests/useful_things.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/useful_things.py diff --git a/tests/useful_things.py b/tests/useful_things.py new file mode 100644 index 0000000..7a8068a --- /dev/null +++ b/tests/useful_things.py @@ -0,0 +1,7 @@ +def add(x, y): + return x + y + + +def subtract(x, y): + # Not sure whether this is correct + return x + y From 2c443ff194d3278c4bee54e5097fef9e2ad6c5fa Mon Sep 17 00:00:00 2001 From: avi bahra Date: Tue, 15 Sep 2020 11:37:02 +0100 Subject: [PATCH 08/11] fixaa --- tests/test_useful_things.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/test_useful_things.py b/tests/test_useful_things.py index 3a946a4..ed4c4f3 100644 --- a/tests/test_useful_things.py +++ b/tests/test_useful_things.py @@ -1,12 +1,8 @@ import useful_things -from hypothesis import given -import hypothesis.strategies as st -@given(st.integers(), st.integers()) def test_add(x, y): assert useful_things.add(x, y) == x + y -@given(st.integers(), st.integers()) def test_subtract(x, y): assert useful_things.subtract(x, y) == x - y From 616a0b45a797bc0563efbabad8810d255c6f06b9 Mon Sep 17 00:00:00 2001 From: avi bahra <58593365+avi369@users.noreply.github.com> Date: Tue, 15 Sep 2020 11:54:20 +0100 Subject: [PATCH 09/11] Update python-app.yml --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index c7f5067..cfe12ad 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest + pip install flake8 pytest hypothesis if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | From d017635c85fd81d29e5b8d88809be8c3afa4fdab Mon Sep 17 00:00:00 2001 From: avi bahra <58593365+avi369@users.noreply.github.com> Date: Tue, 15 Sep 2020 11:56:01 +0100 Subject: [PATCH 10/11] Update test_useful_things.py --- tests/test_useful_things.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_useful_things.py b/tests/test_useful_things.py index ed4c4f3..07ee740 100644 --- a/tests/test_useful_things.py +++ b/tests/test_useful_things.py @@ -1,8 +1,13 @@ import useful_things +from hypothesis import given +import hypothesis.strategies as st + +@given(st.integers(), st.integers()) def test_add(x, y): assert useful_things.add(x, y) == x + y +@given(st.integers(), st.integers()) def test_subtract(x, y): assert useful_things.subtract(x, y) == x - y From 0e472dbd8c5578c6c30d47cf24560b79e4af5913 Mon Sep 17 00:00:00 2001 From: avi bahra <58593365+avi369@users.noreply.github.com> Date: Tue, 15 Sep 2020 12:00:00 +0100 Subject: [PATCH 11/11] Update test_useful_things.py --- tests/test_useful_things.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/test_useful_things.py b/tests/test_useful_things.py index 07ee740..bbd824e 100644 --- a/tests/test_useful_things.py +++ b/tests/test_useful_things.py @@ -7,7 +7,3 @@ def test_add(x, y): assert useful_things.add(x, y) == x + y - -@given(st.integers(), st.integers()) -def test_subtract(x, y): - assert useful_things.subtract(x, y) == x - y