Skip to content

Instantly share code, notes, and snippets.

@ignacysokolowski
Created May 15, 2013 14:51
Show Gist options
  • Save ignacysokolowski/5584572 to your computer and use it in GitHub Desktop.
Save ignacysokolowski/5584572 to your computer and use it in GitHub Desktop.
Shell function for running PyTest with coverage and linting on specified application part
# Run PyTest with coverage and linting on specified application part.
#
# Useful shortcut when you're working at one class/function/module and you
# don't want to run all your tests and need to measure coverage only for what
# you're currently testing.
#
# Example::
#
# $ test_part tests/test_views.py app/views.py -vsk LoginView
#
# 1st param: file or directory with tests to run
# 2nd param: path to measure coverage for
# Any additional params will be added as py.test params
test_part () {
py.test --cov $2 --cov-report term-missing --cov-report html --pep8 --flakes $1 ${@:3}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment