-
Notifications
You must be signed in to change notification settings - Fork 146
Conversation
0280aec
to
645c3ac
Compare
tests/test_docker.sh
Outdated
docker-compose -f local.yml run prediction pytest -rsx | ||
# Coverage should ignore pip packets, files including tests and pytest | ||
docker-compose -f local.yml run prediction coverage run --branch --omit=/usr/local/lib/python3.6/dist-packages/*,src/tests/*,/usr/local/bin/pytest /usr/local/bin/pytest -rsx | ||
docker-compose -f local.yml run prediction coverage html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, this generates a directory htmlcov/
but does not do anything else. We probably want coverage report
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, coverage html
generates this directory which, when being served, offers an interactive report like here which is IMO easier to navigate and understand. However, if it's difficult to persist the whole directory by Travis, it should also be fine to just pass the report
command instead, which creates an output similar to:
Name Stmts Miss Cover Missing
-------------------------------------------------------
my_program.py 20 4 80% 33-35, 39
Wouldn't it be better to push to an external service like coveralls (or similar). This way we get nice GitHub integration where we say "your PR decreases coverage by 2%". I believe some of these services even let you block merges (!!) if you decrease :) |
@lamby I tried this "spike" for a couple of reasons. First, I don't have the rights to add such an integration like coveralls to the repo :-) Second, one would always be required to first push to GitHub to receive a test report if I understand it right. While this not only takes way longer than running the report generation locally, there are also tests that always time out on Travis which means that one can never fully rely on the report generated online. However, I understand your point. |
@isms Any thoughts? :) |
Apparently codecov.io supports Coverage.py. I'm currently trying to add an upload of the generated report to codecov.io on my fork. This way we can have both - a nice HTML version that can be generated locally (if need be) and a repository integration that shows us the changed coverage that would be induced by merging a branch. |
My thought is that a text report in the build is all we're looking for to close the issue. As @WGierke mentioned an integration is easy and just a matter of configuring the build tool. Anyway, fiddling with Travis is out of scope for contributors, so my recommendation is still just to generate the text report as part of the testing commands and leave it there. (We may or may not loop in a third party service this late in the game.) |
645c3ac
to
fde777f
Compare
@lamby @isms Now, we just generate the standard report. If someone wants to add that the report should be uploaded to codecov.io: it worked for me by running
interface service:
|
tests/test_docker.sh
Outdated
|
||
# run the backend API tests | ||
docker-compose -f local.yml run interface python manage.py test | ||
# Coverage should ignore pip packets, files including migrations and tests | ||
docker-compose -f local.yml run interface coverage run --branch --omit=/usr/local/lib/python3.6/dist-packages/*,**/migrations/*.py,**/test*.py manage.py test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make the python version not be hardcoded here? perhaps with */dist-packages/*
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Thanks, I adapted it.
e9b5cb1
to
7510427
Compare
7510427
to
8deb4c5
Compare
Thanks! |
As discussed in #275, it would be helpful to generate a coverage report of the unit tests in which the total coverage and missing lines can be seen. This PR adds Coverage.py which keeps track of which LOC haven't been tested after running the tests. It generates a
htmlcov
directory which includes the HTML files that should be served afterwards to correctly render the report. Examples of such reports for the current master are here: prediction, interface.To persist this report generated by Travis, the project manager need to set up Travis artifacts.
CLA