I just realized that failure of my doctests was not raising error during testing run through GitHub Actions.
How to ensure that failing doctests would trigger failure of the GitHub Actions testing?
Example of a doctest as I’m defining them so far:
from django.test import SimpleTestCase
import doctest
class DocStrings_Tests(SimpleTestCase):
def test_docstrings(self):
from cubes import color_coding
doctest.testmod(color_coding)
and here is the simplified workflow I’m using for testing:
name: Project testing
on: [pull_request, push] # activates the workflow when there is a push or pull request
jobs:
run_project_testing:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
tests: ["cubes", "users", "games"]
steps:
- name: Run Tests - ${{ matrix.tests }}
run: |
pip install coverage
coverage run -p manage.py test ${{ matrix.tests }}
1