Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage in tests #208

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fixes:
- "^.*/site-packages/opentelemetry/sdk/::opentelemetry-sdk/src/opentelemetry/sdk/"
Copy link
Member Author

Choose a reason for hiding this comment

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

We are still testing against site-packages, apparently we want to test the package instead of the local files according to this PR #122

Copy link
Contributor

Choose a reason for hiding this comment

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

@Oberon00 What was the reasoning behind removing the "-e" again? Don't we want to run unit tests against our locally changed files?

Copy link
Member

Choose a reason for hiding this comment

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

@lzchen The -e flag was hiding issues with files that were excluded from packaging. Files were missing from the tarball / wheel files but since -e was being used, the tests were using the unpackaged files.

Copy link
Member

@Oberon00 Oberon00 Oct 9, 2019

Choose a reason for hiding this comment

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

It would be nice to have some configurable tox environment like tox -e py37-test --installation-mode=wheel or tox -e px37-test --with-coverage. But I don't think that is possible out of the box. Maybe we should generate tox.ini with some Jinja2 template 😆

- "^.*/site-packages/opentelemetry/ext/wsgi/::ext/opentelemetry-ext-wsgi/src/opentelemetry/ext/wsgi/"
- "^.*/site-packages/opentelemetry/ext/http_requests/::ext/opentelemetry-ext-http-requests/src/opentelemetry/ext/http_requests/"
- "^.*/site-packages/opentelemetry/::opentelemetry-api/src/opentelemetry/"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pip-log.txt
.tox
.cache
htmlcov
coverage.xml

# Translations
*.mo
Expand Down
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ install:

script:
- tox

after_success:
- pip install codecov
- codecov -v --file
opentelemetry-api/tests/coverage.xml
opentelemetry-sdk/tests/coverage.xml
ext/opentelemetry-ext-wsgi/tests/coverage.xml
ext/opentelemetry-ext-http-requests/tests/coverage.xml
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ python =
[testenv]
deps =
mypy,mypyinstalled: mypy~=0.711
test: coverage

setenv =
mypy: MYPYPATH={toxinidir}/opentelemetry-api/src/
Expand Down Expand Up @@ -47,7 +48,9 @@ commands_pre =
mypyinstalled: pip install file://{toxinidir}/opentelemetry-api/

commands =
test: python -m unittest discover
test: coverage run --source {envsitepackagesdir}/opentelemetry -m unittest discover
test: coverage report
test: coverage xml

mypy: mypy --namespace-packages opentelemetry-api/src/opentelemetry/
; For test code, we don't want to enforce the full mypy strictness
Expand Down