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

some problems using it from command line #9

Closed hugoArregui closed 11 years ago

hugoArregui commented 11 years ago

Hi,

I have a few problems running lcov_covertura from command line, I wrote a patch with some small changes.

diff --git a/lcov_cobertura/lcov_cobertura.py b/lcov_cobertura/lcov_cobertura.py
index f80c0a5..432cbd0 100755
--- a/lcov_cobertura/lcov_cobertura.py
+++ b/lcov_cobertura/lcov_cobertura.py
@@ -319,14 +319,14 @@ if __name__ == '__main__':
                           dest='output', default='coverage.xml')
         (options, args) = parser.parse_args(args=argv)

-        if len(argv) != 2:
-            print((main.__doc__))
-            sys.exit(1)
+        #if len(argv) != 2:
+            #print((main.__doc__))
+            #sys.exit(1)

         try:
             with open(args[1], 'r') as lcov_file:
                 lcov_data = lcov_file.read()
-                lcov_cobertura = LcovCobertura(lcov_data, options)
+                lcov_cobertura = LcovCobertura(lcov_data, options.base_dir)
                 cobertura_xml = lcov_cobertura.convert()
             with open(options.output, mode='wt') as output_file:
                 output_file.write(cobertura_xml)

I just comment the lines that checks argv len, because I don't figure out if it's a needed check. But I want to add, if it's necesary, you need to be carefoul about how the program is invoked,

./lcov_coverage python lcov_coverage

has differents argv values.

Thanks for this amazing tool!

eriwen commented 11 years ago

@hugoArregui Thanks for the note. I've corrected this.