Skip to content

Instantly share code, notes, and snippets.

@flying-sausages
Created March 24, 2021 17:14
Show Gist options
  • Save flying-sausages/9a2ebe269dedf296ff363392903136cc to your computer and use it in GitHub Desktop.
Save flying-sausages/9a2ebe269dedf296ff363392903136cc to your computer and use it in GitHub Desktop.
Auto-generating coverage xml report for Gutters in VSCode when test run
[run]
omit='.env/*'
source='.'
[report]
show_missing = true
[pytest]
DJANGO_SETTINGS_MODULE = webtas.settings
; python_files = tests.py test_*.py *_tests.py
addopts = --cov='webtas' --cov='tas' --cov-config=.coveragerc --cov-report=xml

#What is this Do you want automatic code coverage generated for your project as soon as you save a file?

Install these extensions and configure them:

Add the options from the config files to the root of your project

To run this, do:

  1. Save any file
  2. Test explorer triggers pytest
  3. pytest generates coverage
  4. coverage generates xml
  5. Click "watch" on status bar
  6. Gutters will start appearing
pytest-cov==2.11.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment