From 216a633805eb535243102bac43a13d650d1d1161 Mon Sep 17 00:00:00 2001 From: Christopher Owen Date: Thu, 10 Oct 2024 10:48:20 +0100 Subject: [PATCH] Add pytest action --- .github/workflows/main.yml | 7 ++++--- test_longest.py | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 test_longest.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1efca02..7eb4b7d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Run Code +name: Run Tests on: workflow_dispatch: pull_request: @@ -7,11 +7,12 @@ on: - main jobs: run_code: - name: Runs my code + name: Run my tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.12' - - run: python longest.py + - run: pip install pytest + - run: pytest test_longest.py diff --git a/test_longest.py b/test_longest.py new file mode 100644 index 0000000..2af0a9d --- /dev/null +++ b/test_longest.py @@ -0,0 +1,5 @@ +from longest import find_longest + + +def test_get_longest(): + assert "yellow" == find_longest(["yellow", "red", "blue", "green"])