Skip to content

Port coverage report generation to pytest #978

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

Merged

Conversation

palnabarun
Copy link
Member

Fixes #976

@k8s-ci-robot
Copy link
Contributor

Welcome @palnabarun!

It looks like this is your first PR to kubernetes-client/python 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/python has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 6, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 6, 2019
@palnabarun
Copy link
Member Author

cc @micw523

@palnabarun palnabarun changed the title Ports coverage report generation to pytest [WIP] Ports coverage report generation to pytest Oct 6, 2019
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 6, 2019
@palnabarun palnabarun force-pushed the coverage-pytest-port branch 2 times, most recently from f72aafa to 57cf810 Compare October 6, 2019 05:12
@palnabarun palnabarun changed the title [WIP] Ports coverage report generation to pytest Ports coverage report generation to pytest Oct 6, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 6, 2019
@palnabarun palnabarun force-pushed the coverage-pytest-port branch from 57cf810 to 5471df7 Compare October 6, 2019 05:17
@palnabarun palnabarun changed the title Ports coverage report generation to pytest Port coverage report generation to pytest Oct 6, 2019
@yliaog
Copy link
Contributor

yliaog commented Oct 8, 2019

/assign @micw523

@micw523
Copy link
Contributor

micw523 commented Oct 8, 2019

The coverage test is to provide a coverage report for codecov-io bot. It looks like you're running more tests than you need to - could you fix those? The tests in kubernetes/test does not have to be run for the coverage.

tox.ini Outdated

[testenv:coverage]
commands =
python -V
nosetests --with-coverage --cover-package=kubernetes.config,kubernetes.watch --cover-tests
pytest --ignore=kubernetes/e2e_test --cov=kubernetes/watch --cov=kubernetes/config
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the tests for the dynamic client in base/dynamic are all e2e tests, which will be skipped by using pytest without a local cluster. If we are only testing the coverage for the watch and config folders we can skip those tests (for now).

@palnabarun
Copy link
Member Author

palnabarun commented Oct 11, 2019

Okay. I got it. I was assuming that kubernetes/test also has the tests for k/config and k/watch. Saw that they are inside the directories themselves.

@palnabarun
Copy link
Member Author

One small caveat that I bumped into though. When I limited the test run to kubernetes/config and kubernetes/watch, there was one line of code that was not covered by tests by those test.

image

The test that I ran:

pytest --cov=kubernetes/watch --cov=kubernetes/config kubernetes/watch kubernetes/config

@micw523 Is it acceptable to have that?

@palnabarun palnabarun force-pushed the coverage-pytest-port branch from 5471df7 to 5d4145e Compare October 11, 2019 05:13
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 11, 2019
@palnabarun
Copy link
Member Author

Updates: When I saw the coverage on the Travis CI interface, the very same line seems to be covered now. Maybe I have some inconsistencies in my dev environment.

@micw523
Copy link
Contributor

micw523 commented Oct 14, 2019

/lgtm
Please squash your commits

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 14, 2019
@palnabarun palnabarun force-pushed the coverage-pytest-port branch from 5d4145e to 064b80e Compare October 16, 2019 09:54
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2019
@palnabarun
Copy link
Member Author

@micw523 Done. Please approve. :)

@micw523
Copy link
Contributor

micw523 commented Oct 16, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2019
@yliaog
Copy link
Contributor

yliaog commented Oct 16, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: palnabarun, yliaog

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 16, 2019
@k8s-ci-robot k8s-ci-robot merged commit 9c205e6 into kubernetes-client:master Oct 16, 2019
@palnabarun
Copy link
Member Author

Thank you @micw523 @yliaog :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch Python Testing Package to Pytest
4 participants