Skip to content

Instantly share code, notes, and snippets.

@shreyansp
Last active July 10, 2024 18:04
Show Gist options
  • Save shreyansp/996421e125d5b36e684c8a492a5403c0 to your computer and use it in GitHub Desktop.
Save shreyansp/996421e125d5b36e684c8a492a5403c0 to your computer and use it in GitHub Desktop.
pytest setup and commands

Install

conda install asynctest mock pytest-asyncio pytest-cov pytest-mock pytest-xdist -y

Run

python -m pytest <root_dir> --cov --cov-config .coveragerc --cov-report=lcov:lcov.info --cov-report=xml --cov-report=term-missing

Troubleshooting

  • In VScode, test debugging won't work together with test coverage
    • Suggestion: Setup VSCode for test debugging, and use command line for covrage run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment