Kaizen Today I Learned by Ville Säävuori

Pytest Cheat Sheet

Running

  • Fail fast / stop after first failure: pytest -x
  • Run from module or directory: pytest dir/tests/footest.py, pytest dir/
  • Run specific markers: pytest -m marker (mark with @pytest.mark.mymarker)
  • Drop to pdb on failure: pytest --pdb (set breakpoint w/ breakpoint())
  • Recreate database using pytest-django: --create-db

Configuration

Tagged with , ,

Published . Last modified .