diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..fa464ee0 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[report] +fail_under = 70 diff --git a/.travis.yml b/.travis.yml index 0ee96174..c94daf1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,10 @@ python: - 2.7 install: - - pip install codecov + - pip install -r requirements/travis.txt script: - - coverage run tests.py + - py.test -v --cov=awesome tests.py after_success: - codecov diff --git a/README.md b/README.md index 01482b44..26ee5c43 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +[![Build Status](https://travis-ci.org/sbellem/example-python.svg)](https://travis-ci.org/sbellem/example-python) +[![codecov.io](https://codecov.io/github/sbellem/example-python/coverage.svg?branch=master)](https://codecov.io/github/sbellem/example-python?branch=master) +![codecov.io](https://codecov.io/github/sbellem/example-python/branch.svg?branch=master) + + Python Example ======= | [https://codecov.io/][1] | [@codecov][2] | [hello@codecov.io][3] | diff --git a/awesome/__init__.py b/awesome/__init__.py index 4d34acc6..7531841d 100644 --- a/awesome/__init__.py +++ b/awesome/__init__.py @@ -1,5 +1,14 @@ def smile(): - return ":)" + return ':)' + def frown(): - return ":(" + return ':(' + + +def laugh(): + return ':-D' + + +def cry(): + return '(:_;)' diff --git a/requirements/travis.txt b/requirements/travis.txt new file mode 100644 index 00000000..c391699a --- /dev/null +++ b/requirements/travis.txt @@ -0,0 +1,3 @@ +codecov==1.6.2 +pytest==2.8.2 +pytest-cov==2.2.0 diff --git a/tests.py b/tests.py index 92aa2034..59b58c9e 100644 --- a/tests.py +++ b/tests.py @@ -1,12 +1,18 @@ -import unittest +def test_smile(): + from awesome import smile + assert smile() == ':)' -import awesome +def test_frown(): + from awesome import frown + assert frown() == ':(' -class TestMethods(unittest.TestCase): - def test_add(self): - self.assertEqual(awesome.smile(), ":)") +def test_laugh(): + from awesome import laugh + assert laugh() == ':-D' -if __name__ == '__main__': - unittest.main() + +def test_cry(): + from awesome import cry + assert cry() == '(:_;)'