'NoneType' object has no attribute 'has_file'
dimaqq opened this issue · 4 comments
dimaqq commented
I'm trying to diff a couple of files generated by python coverage tool and converted to XML.
I get an exception here:
383 def file_source(self, filename):
384 """
385 Return a list of namedtuple `Line` for each line of code found in the
386 given file `filename`.
387
388 """
--> 389 if self.cobertura1.has_file(filename) and self.cobertura1.filesystem.has_file(
390 filename
391 ):
392 lines1 = self.cobertura1.source_lines(filename)
393 line_statuses1 = dict(self.cobertura1.line_statuses(filename))
AttributeError: 'NoneType' object has no attribute 'has_file'
Somehow the 2nd clause, self.cobertura1.filesystem
is None.
aconrad commented
Thanks for reporting. Can you provide the command line you used to get this error?
dimaqq commented
Not a command, I tried
Line 393 in 22b6d34
In the end I've worked around it by passing a filesystem smth object to the cobertura constructor.
I guess the readme can be updated
aconrad commented
Ah, I see. I'll take a look at the README this coming week.
kumarak-deshaw commented
FTR, it works if the cobertura instantiation has filesystem arg
cobertura1 = Cobertura(xml1, filesystem=filesystem_factory(xml1, source_prefix))
cobertura2 = Cobertura(xml2, filesystem=filesystem_factory(xml2, source_prefix))
reporter = HtmlReporterDelta(cobertura1, cobertura2, show_source=True)
reporter.generate()