FaradayRF / faradayio

FaradayRF TUN/TAP adapter
https://www.faradayrf.com
GNU General Public License v3.0
15 stars 6 forks source link

Add Code Unit Test Coverage To Project #30

Closed kb1lqc closed 6 years ago

kb1lqc commented 6 years ago

Try implemented coveralls to show the code coverage of our unit tests.

https://coveralls.io/

This should also integrate with travis-ci as much as possible.

https://docs.travis-ci.com/user/coveralls/

I'm guessing we should use the largest of the two python options: https://github.com/coveralls-clients/coveralls-python

This one has the latest commit and larger stars on github. Arbitrary but I like using something better supported/used.

Tasks:

kb1lqc commented 6 years ago

OK I have something working I guess. I used http://www.robinandeer.com/blog/2016/06/22/how-i-test-my-code-part-3/ to help me run pytest-cov and called the faradayio package to get the following report.

sudo .venv/bin/pytest --cov-report html --cov faradayio

image

I am a bit confused that I run faradayio without reall having a package built. It hopefully is catching the entire module.

kb1lqc commented 6 years ago

Removing the HTML output I get a nice command line feedback: image

kb1lqc commented 6 years ago

OK I should move this to travis-ci

kb1lqc commented 6 years ago

Also got this to work with coveralls:

sudo .venv/bin/python3 -m coverage run .venv/bin/pytest

image

kb1lqc commented 6 years ago

It worked! Looks like it is as simple as adding the coveralls test line. It does appear I am counting the root directory as well which is really bringing down the code coverage value. This seems like I'm missing a configuration value.

https://travis-ci.org/kb1lqc/faradayio/builds/334512896

image

Here's a coverage badge on this build: Coverage Status image

kb1lqc commented 6 years ago

Alright specifying the source directory for faradayio in .coveragerc worked! https://coveralls.io/builds/15260517

image

kb1lqc commented 6 years ago

Merged into develop per kb1lqc/faradayio#3