MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / write_results

Method write_results

tools/python-3.11.9-amd64/Lib/trace.py:205–294  ·  view source on GitHub ↗

Write the coverage results. :param show_missing: Show lines that had no hits. :param summary: Include coverage summary per module. :param coverdir: If None, the results of each module are placed in its directory, otherwise it is includ

(self, show_missing=True, summary=False, coverdir=None)

Source from the content-addressed store, hash-verified

203 callers[key] = 1
204
205 def write_results(self, show_missing=True, summary=False, coverdir=None):
206 """
207 Write the coverage results.
208
209 :param show_missing: Show lines that had no hits.
210 :param summary: Include coverage summary per module.
211 :param coverdir: If None, the results of each module are placed in its
212 directory, otherwise it is included in the directory
213 specified.
214 """
215 if self.calledfuncs:
216 print()
217 print("functions called:")
218 calls = self.calledfuncs
219 for filename, modulename, funcname in sorted(calls):
220 print(("filename: %s, modulename: %s, funcname: %s"
221 % (filename, modulename, funcname)))
222
223 if self.callers:
224 print()
225 print("calling relationships:")
226 lastfile = lastcfile = ""
227 for ((pfile, pmod, pfunc), (cfile, cmod, cfunc)) \
228 in sorted(self.callers):
229 if pfile != lastfile:
230 print()
231 print("***", pfile, "***")
232 lastfile = pfile
233 lastcfile = ""
234 if cfile != pfile and lastcfile != cfile:
235 print(" -->", cfile)
236 lastcfile = cfile
237 print(" %s.%s -> %s.%s" % (pmod, pfunc, cmod, cfunc))
238
239 # turn the counts data ("(filename, lineno) = count") into something
240 # accessible on a per-file basis
241 per_file = {}
242 for filename, lineno in self.counts:
243 lines_hit = per_file[filename] = per_file.get(filename, {})
244 lines_hit[lineno] = self.counts[(filename, lineno)]
245
246 # accumulate summary info, if needed
247 sums = {}
248
249 for filename, count in per_file.items():
250 if self.is_ignored_filename(filename):
251 continue
252
253 if filename.endswith(".pyc"):
254 filename = filename[:-1]
255
256 if coverdir is None:
257 dir = os.path.dirname(os.path.abspath(filename))
258 modulename = _modname(filename)
259 else:
260 dir = coverdir
261 os.makedirs(dir, exist_ok=True)
262 modulename = _fullmodname(filename)

Callers 1

mainFunction · 0.95

Calls 13

is_ignored_filenameMethod · 0.95
write_results_fileMethod · 0.95
sortedFunction · 0.85
_modnameFunction · 0.85
_fullmodnameFunction · 0.85
_find_executable_linenosFunction · 0.85
endswithMethod · 0.80
openFunction · 0.70
printFunction · 0.50
getMethod · 0.45
itemsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected