-
Notifications
You must be signed in to change notification settings - Fork 32
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
Run coverage in subdirectory #184
Conversation
End-to-end public repo |
8cc17dc
to
3709909
Compare
Coverage reportThe coverage rate went from
Diff Coverage details (click to unfold)coverage_comment/files.py
coverage_comment/coverage.py
coverage_comment/main.py
coverage_comment/subprocess.py
coverage_comment/settings.py
|
This looks great <3. That's pretty much how I imagined it too.
Yes, that wouldn't be a bad idea at least once for testing, maybe permanently. |
Looking forward for this contribution! I just stumbled upon this project and was searching how to set a subdirectory for coverage in my monorepo project. |
I did a one-off test in https://github.com/ewjoachim/python-coverage-comment-action-devenv/tree/master where coverage ran from the |
Also, that. |
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.
Looks very good, thank you. Just some small comments from my side. I also took the liberty to fix a few spelling mistakes (that were already there before) and raise the coverage to 100%.
a7b816b
to
f7cde42
Compare
Okay, hopefully, we should be good :) |
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.
Okay, that looks good so far. However, I did some more tests with a copy of our example repo and for push everything works, but for PR the action crashes. This is because diff-cover
always specifies the file paths relative to the root of the repo no matter where you run the command and the other coverage data is always relative to the COVERAGE_PATH
.
I would therefore recommend that we always add COVERAGE_PATH
to the file paths that are stored in the coverage data. This would also solve another problem. With the change in this PR it is no longer necessarily apparent to which files the comment refers, because absolute paths are no longer used. This can be very confusing, especially when several comments are posted (which will probably happen with #213), because you would have to figure out from the context which code it is about.
It might also be useful to add an integration test that completely tests a case with COVERAGE_PATH
once. This way we would probably have noticed the problem earlier.
But I just tried to write such a test myself and I already see that it is not easy if you don't want to duplicate all fixtures. I'm still trying things out a bit. But if you have an idea in that direction, feel free to implement it.
8505bd0
to
3231d6c
Compare
Good news everyone: I've set up the e2e tests to use a src repo, and hopefully, this will reproduce the issue (though I'm still struggling a little) Also, it's very tedious to launch the action locally :( And I don't reproduce locally :( but I've reproduced on a dev-env GH repo. |
c138851
to
5102eb3
Compare
Dammit, I don't reproduce the issue :( |
5102eb3
to
534acb8
Compare
There seem to be an awful lot of unrelated commits in this PR :/ Sorry about that, tell me if you'd rather I'd move them in a different one. |
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.
There seem to be an awful lot of unrelated commits in this PR :/ Sorry about that, tell me if you'd rather I'd move them in a different one.
Thank you, very considerate. But it wasn't that bad.
Now everything looks perfect. I also tested it again in a repo, but with the e2e tests (thanks again for all the work you put in to reproduce the issue) it shouldn't be a problem anymore anyway. I guess we should be ready to merge then, right?
Hey :) |
I'd say "days", no promises. |
Closes #167 (and linked to #16)
I'm not 100% sure it works, because I've mostly make tests pass, but I'd like to try that for real (and wondering about changing the e2e tests to use a subdir)