Reputation: 1091
I have a file test_gather.py
import gather
class TestGather(unittest.TestCase):
def test_01_gather(self):
self.assertEqual(len(gather.lookup_terms) > 2, True)
if __name__ == '__main__':
unittest.main()
This runs in coveralls, but the last line is never reached. (https://coveralls.io/builds/3180464/source?filename=tests%2Ftest_gather.py )
My travis.yaml
is below:
language: python
python:
- "3.4"
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
install:
- pip install .
- pip install coverage
- pip install nose coverage
- pip install coveralls
script:
- python setup.py nosetests --with-coverage --cover-package pypiview
- coverage run --source=rawdata setup.py test
- nosetests --with-coverage
after_success:
coveralls
How can I configure this to ensure all tests/test_*.py
files get run so that the last line is also executed?
Upvotes: 1
Views: 1641
Reputation: 375754
You are using test discovery to find and run the tests. You don't need the if __name__
clause at all. Just delete it.
Upvotes: 1