diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index caafdbb..c5d6c07 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,28 +1,31 @@ name: cicd +# only run this workflow when something is pushed to main on: push: branches: - main +# define our jobs jobs: - build: - + build_and_test: + # define our OS runs-on: ubuntu-latest + # rely on predefined GitHub actions to setup our python environment steps: - uses: actions/checkout@v2 - - - name: Set up Python 3.8 + # setup step + - name: setup uses: actions/setup-python@v2 with: - python-version: 3.8 - + python-version: 3.9 + # install step - name: install run: | python -m pip install --upgrade pip pip install pytest - + # test step - name: test run: | pytest tests/ diff --git a/tests/test_script.py b/tests/test_script.py index 561e1a7..1afac0d 100644 --- a/tests/test_script.py +++ b/tests/test_script.py @@ -2,9 +2,10 @@ import subprocess def test_script_output(capfd): + # run the script file under a new process subprocess.run(['python', './script.py']) - # Capture the output + # Capture process output captured = capfd.readouterr() # Assert the output is correct