Before automating anything, always run it by hand first. If you can't run your tests on your own machine, a CI server won't be able to either. So let's run the tests, and the linter, exactly as our pipeline will.
Pytest dash Q runs every test quietly. Three dots, three passed. Then flake8 checks the code style. It printed nothing, which means no problems. Finally, echo dollar question mark shows the exit code of the last command. Zero means success. That number is how CI knows whether a step passed.
Terminal
pytest -q... [100%]3 passed in 0.01sflake8echo $?0
Now let's break something on purpose. Sed changes the tax from point two to point three. Pytest finds the problem straight away. It shows which test failed, what it expected, and what it got. And the exit code is one, not zero. A pipeline would stop right here, and mark the change as failed.
Terminal
sed -i 's/tax=0.2/tax=0.3/' app.pypytest -qF.. [100%]======================================== FAILURES ========================================__________________________________ test_total_adds_tax ___________________________________ def test_total_adds_tax():> assert total([10, 20]) == 36.0E assert 39.0 == 36.0E + where 39.0 = total([10, 20])test_app.py:6: AssertionError================================ short test summary info =================================FAILED test_app.py::test_total_adds_tax - assert 39.0 == 36.01 failed, 2 passed in 0.02secho $?1