diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index adeca06..04aed5c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -27,8 +27,5 @@ jobs: - name: Black check run: black --check . - - name: Flake8 lint - run: flake8 . - - name: Run tests - run: pytest -q + run: pytest -q tests diff --git a/README.md b/README.md index f33b12a..510d2cf 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # workflow-python-lint Only allows code that passes common linters for Python (black, etc) to merge into main + +In the repo settings, open Branches, add a rule for main, and enable Require a pull request before merging. +Turn on Require status checks to pass and select Python CI or the ci job as a required check. diff --git a/app.py b/app.py new file mode 100644 index 0000000..5e6bf0d --- /dev/null +++ b/app.py @@ -0,0 +1,2 @@ +def hello(): + return "Hello World" diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ + diff --git a/tests/test_hello.py b/tests/test_hello.py new file mode 100644 index 0000000..9150228 --- /dev/null +++ b/tests/test_hello.py @@ -0,0 +1,5 @@ +from app import hello + + +def test_hello_returns_expected_message(): + assert hello() == "Hello World"