eriwen / lcov-to-cobertura-xml

Converts lcov output to Cobertura-compatible XML for CI
https://eriwen.github.io/lcov-to-cobertura-xml/
Apache License 2.0
187 stars 73 forks source link

CLI entry point regression #40

Closed dokempf closed 2 years ago

dokempf commented 2 years ago

Between 1.6 and 2.0 there has been a regression w.r.t. the command line entry point. Doing python -m lcov_cobertura would work in 1.6, but produce the following error in 2.0:

../bin/python: No module named lcov_cobertura.__main__; 'lcov_cobertura' is a package and cannot be directly executed

Most probably an accidental side effect of the setup.py -> setup.cfg transition.

egfx-notifications commented 2 years ago

I would not consider this to be an accidental side effect, the directory structure seems to be more mature now. The executable is now also properly installed and reachable in $PATH, so if you only need to run this on the command line you can just do this now:

$ pip install lcov_cobertura
$ lcov_cobertura ....
dokempf commented 2 years ago

Thanks, that helps of course. Whether intentional or not, I would still consider it a regression. After all, both of these methods can be implemented to achieve backwards compatibility (e.g. by providing __main__.py).

egfx-notifications commented 2 years ago

Yes, that's true. I first noticed the change because of breaking CI pipelines ;)

sarnold commented 2 years ago

Yes, you cannot import a package name, and in this case you get exactly the same behavior if you try importing the module name:

python -m lcov_cobertura.lcov_cobertura

    Converts LCOV coverage data to Cobertura-compatible XML for reporting.

    Usage:
        lcov_cobertura.py lcov-file.dat
        lcov_cobertura.py lcov-file.dat -b src/dir -e test.lib -o path/out.xml

    By default, XML output will be written to ./coverage.xml
eriwen commented 2 years ago

Fixed by a07765117c23073e36cfd2e88e3793c6ae57045d and released in version 2.0.2 https://pypi.org/project/lcov-cobertura/2.0.2/