This is a simple GitHub repository that shows how you can use GitHub Actions to run unittests on Python code.
The configuration for the Actions workflow is found here at .github/workflows/py-unittest.yml, and it simply runs the command:
actions-ci-unittest/.github/workflows/py-unittest.yml
Lines 26 to 27 in 216a042
One of the tests to be run has a failure due to some bad math 😏:
actions-ci-unittest/my_test.py
Lines 19 to 21 in 52c46af
To see the failing test results, visit the results of this job.
You'll notice that the test failed and the reason given is:
AssertionError: 4 != 5
You can easily fix the failing test with this Pull Request- "Fix Failing Unittest"
And sure enough, the tests pass and the GitHub Actions workflow shows green 🟢:
As well as when looking at the Pull Request itself: