Created
March 2, 2014 21:34
-
-
Save thomir/9314320 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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