> py.test --cov=packagename --pyargs packagename
to perform unit testing. It will report coverage percentage, which roughly means how many lines of codes are covered with unit testing.
2. doctest: under the definition of a function, we can include document testing, e.g.
def f(x):Then we can run doctest that check for correct result
"""
Examples:
>>> f(2)
4
"""
return x**2
3. style test: to make sure that our codes are in good styles, we can do
> py.test --pep8 --flakes --pyargs hyperemble
4. Travis: to make sure that our codes work across platform, across different version of Python, we can use travis. Upload the code to github, and travis will perform test across different platform for correctness
1. Create a github repository with README.md and license,
2. Create a setup.py
3. Create a Makefile that contains make style and make test
4. Add Travis CI support
5. Add requirements.txt for the require packages
No comments:
Post a Comment