@@ -326,16 +326,17 @@ def write_results(self, show_missing=True, summary=False, coverdir=None):
326326 lnotab = _find_executable_linenos (filename )
327327 else :
328328 lnotab = {}
329+ if lnotab :
330+ source = linecache .getlines (filename )
331+ coverpath = os .path .join (dir , modulename + ".cover" )
332+ with open (filename , 'rb' ) as fp :
333+ encoding , _ = tokenize .detect_encoding (fp .readline )
334+ n_hits , n_lines = self .write_results_file (coverpath , source ,
335+ lnotab , count , encoding )
336+ if summary and n_lines :
337+ percent = int (100 * n_hits / n_lines )
338+ sums [modulename ] = n_lines , percent , modulename , filename
329339
330- source = linecache .getlines (filename )
331- coverpath = os .path .join (dir , modulename + ".cover" )
332- with open (filename , 'rb' ) as fp :
333- encoding , _ = tokenize .detect_encoding (fp .readline )
334- n_hits , n_lines = self .write_results_file (coverpath , source ,
335- lnotab , count , encoding )
336- if summary and n_lines :
337- percent = int (100 * n_hits / n_lines )
338- sums [modulename ] = n_lines , percent , modulename , filename
339340
340341 if summary and sums :
341342 print ("lines cov% module (path)" )
0 commit comments