robust path management and package specification
Currently we map a package or a module to a path using undocumented internals (cf #30 which changes this).
I am not aware of a robust mechanism for doing this, other than calling internals. I wonder if we could just default to working on the current project.
It is still not clear how to query the path of the resulting cov files (again, other than hacks).
Thanks for posting. Instead of
Base.locate_package(Base.PkgId("MyPackage"))
is it an option to use
pkgdir(MyPackage)
In other words, require an actual Module?
I think it would be best to accept everything (including no argument), and just pass it on to Pkg.test, and have the call specify an output path for the coverage info. Currently the Pkg.test framework does not allow this, but after JuliaLang/Pkg.jl#3178 or a similar solution is merged it should work.
We could then save the location (or maybe the whole coverage info) in PackageCoverage, so the results would be decoupled from the filesystem. If this works, coverage generation would not litter the filesystem and would also work for read-only directories.
Update: the above PR has been merged, so if that ends up in 1.9 then we can revisit this.
Hey @tpapp, I'm currently doing some CI job using LocalCoverage on a Gitlab self-hosted instance and after some thinking, it feels like the path written by LocalCoverage in the coverage files poses a problem with the display of covered lines in the merge request diff. Do you have any experience about this ?
This problem shows on a repo where I have several languages and my julia code is in a <git root>/julia subfolder.
it feels like the path written by LocalCoverage in the coverage files poses a problem with the display of covered lines in the merge request diff. Do you have any experience about this ?
Can you describe the problem in detail? No, I do not recall seeing this.
On a related note, I will revisit this issue soon but currently I have very little time. PRs welcome.
I'll try to see if I can contribute. About the GitLab related problem, maybe it is just related to my limited experience of how it should be displayed. Could you highlight that on your https://gitlab.com/tkpapp/GitlabJuliaDemo.jl?
Unfortunately, that repo is somewhat outdated, I haven't used Gitlab for a while.
@tpapp So I tested modifications of the path w.r.t the repo path and now coverage diff display works. I achieved this using a bit of sed. Basically any path in the cobertura file should have its root in the repo base dir.
I'll try to find a way to implement this.