I’m writing a python library (speedcurve.py). At work, we’re using SpeedCurve to track our web performance. SpeedCurve’schangelog reveals can trigger a deployment (and a series of tests). I’m replacing our curl+ansible commands with this. I plan on integrating this with slack as well.
This project is heavily influenced by github3.py. I’ve been contributing frequently (plan on continuing to) and find it elegant. You’ll notice A LOT of similarities.
- For this project, I want the following up front:
-
- Proper Documentation
- 100% test coverage and flake8 checks
- Integration with Travis CI
This post focuses on configuring tox to execute coverage.
Configure tox + coverage
Since tox does NOT play nicely with pipes (|), this simple shell scripts checks for 100% test coverage:
#!/bin/sh
coverage run --source speedcurve -m py.test
coverage report | tail -n 1 | grep '^TOTAL.*100%$'
This goes in tox.ini
[testenv:coverage]
commands =
./coverage-check.sh