Skip to content

Instantly share code, notes, and snippets.

@thomir
Created March 2, 2014 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomir/9314320 to your computer and use it in GitHub Desktop.
Save thomir/9314320 to your computer and use it in GitHub Desktop.
#!/bin/sh -ex
if [ -d reproducer_ve ]; then
rm -r reproducer_ve
fi
virtualenv reproducer_ve
. reproducer_ve/bin/activate
if [ "$1" = "-fail" ]; then
pip install coverage
else
pip install coverage==3.6
fi
cat > foo.py <<EOF
def bar(a, b):
if a < 0:
return a + b
return a - b
EOF
cat > test_foo.py <<EOF
from foo import bar
from unittest import TestCase
class FooTests(TestCase):
def test_bar(self):
bar(1, 2)
EOF
coverage run -m unittest test_foo
coverage html
xdg-open htmlcov/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment