Skip to content

Running Tests

Always have the --keepdb option in PyCharm

  • In PyCharm click the green triangle beside a test

Running tests in terminal

python manage.py test path.app.tests.ClassName.testName --keepdb
  • -k flag: match test name patterns
python manage.py test -k match.pattern1 -k match.pattern2

Code coverage

pip install coverage

# replace `python` with `coverage run`
coverage run --branch manage.py test
coverage html

Last update: 2023-04-24