Skip to content

enable tracking of test suite coverage using coveralls#3204

Merged
boegel merged 6 commits intoeasybuilders:developfrom
shahzebsiddiqui:coverage
Feb 20, 2020
Merged

enable tracking of test suite coverage using coveralls#3204
boegel merged 6 commits intoeasybuilders:developfrom
shahzebsiddiqui:coverage

Conversation

@shahzebsiddiqui
Copy link
Copy Markdown
Contributor

coveralls from marketplace to get report in coveralls

coveralls from marketplace to get report in coveralls
@shahzebsiddiqui
Copy link
Copy Markdown
Contributor Author

@boegel can you please enable coveralls from marketplace https://github.com/marketplace/coveralls
This PR will try to send report to coveralls from travis automatically. I dont know if coverage is setup properly. Right now I only ran it for python module test.framework.suite

@easybuilders easybuilders deleted a comment from boegelbot Feb 16, 2020
@boegel boegel added the change label Feb 16, 2020
@boegel boegel added this to the 4.x milestone Feb 16, 2020
@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 16, 2020

@shahzebsiddiqui I think that coveralls is now available for the easybuild-framework repo.

We'll need to fix the issue where coverage report -m is tripping over the non-existing generic/foobar.py easyblock that is injected at runtime by one of the tests though...

I guess coverage is picking up the use of that files, and expects it to still be there when collecting the report. Can we make it ignore missing files?

@easybuilders easybuilders deleted a comment from boegelbot Feb 16, 2020
@shahzebsiddiqui
Copy link
Copy Markdown
Contributor Author

@boegel I cant seem to find where generic/foobar.py easyblock is stored relative to Travis build. Yes there is a way to ignore files during coverage report that can be configured in .coveragerc

See https://coverage.readthedocs.io/en/coverage-5.0.3/source.html

I think something like

[run]
omit = 
  - <path>/generic/foobar.py

coverage can even exclude by lines. Most useful when ignoring methods that you know are not to be tested or part of development that you can blacklist for time being. See https://coverage.readthedocs.io/en/coverage-5.0.3/excluding.html

I can fix it but dont know the full path to easyblock relative to Travis build directory.

@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 18, 2020

@shahzebsiddiqui The issue is that this file is only created when a specific test is running, and then cleaned up afterwards (it's only stored for a short while in a temporary location).

So, the path changes on every run (to ensure a unique temporary location).

It may be possible to tweak the test a bit to avoid that coveralls thinks the file should still be there though...

@easybuilders easybuilders deleted a comment from boegelbot Feb 18, 2020
@shahzebsiddiqui
Copy link
Copy Markdown
Contributor Author

@boegel well i am going to try one more thing clearly from the log it looks like a coverall issue.

Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.6.7/bin/coveralls", line 8, in <module>
    sys.exit(wear())
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/coveralls/__init__.py", line 78, in wear
    from coveralls.control import coveralls
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/coveralls/control.py", line 2, in <module>
    from coveralls.report import CoverallsReporter
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/coveralls/report.py", line 6, in <module>
    from coverage.report import Reporter
ImportError: cannot import name 'Reporter'

I found a similar issue reported so i will try to remove python-coveralls and just use coveralls to test if it works in travis.
z4r/python-coveralls#74

Testing Travis  Build due to similar error reported with where it fails to import Reporter z4r/python-coveralls#73
@shahzebsiddiqui
Copy link
Copy Markdown
Contributor Author

@boegel all Travis builds were complete, only one build failed and it is okay since it was Python 2.6 unable to install coveralls. Anyhow i think it is a good step to get coveralls. Once you merge this, all incoming PRs that pass Travis build will get uploaded to coveralls and you can view the coverage report. As of now the develop branch is at 72.642%

Comment thread .travis.yml Outdated
Comment thread .travis.yml Outdated
Comment thread .travis.yml Outdated
Only run coverage report and push to coveralls for all builds except for Python 2.6
@easybuilders easybuilders deleted a comment from boegelbot Feb 20, 2020
Comment thread .travis.yml Outdated
# run test suite
- python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
# run coverage on all travis builds except for Python 2.6
- if [ "x$TRAVIS_PYTHON_VERSION" != 'x2.6' ]; then coverage run -m test.framework.suite; coverage report -m --ignore-errors; fi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shahzebsiddiqui You should include the 2>&1 | tee test_framework_suite.log part after coverage run -m test.framework.suite, that's important w.r.t. a check below where we make sure there's no unexpected output from the test suite.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boegel Looks good to me, everything is green

@boegel boegel changed the title testing coverage report gathering in travis build. Need to enable enable tracking of test suite coverage using coveralls Feb 20, 2020
@boegel boegel modified the milestones: 4.x, next release (4.1.2?) Feb 20, 2020
@boegel
Copy link
Copy Markdown
Member

boegel commented Feb 20, 2020

See coverage report @ https://coveralls.io/github/easybuilders/easybuild-framework

Thanks a lot for looking into this @shahzebsiddiqui!

@boegel boegel merged commit 3f12a13 into easybuilders:develop Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants