Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(35166)

Side by Side Diff: Lib/trace.py

Issue 10541: regrtest.py -T broken
Patch Set: Created 8 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_trace.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 2
3 # portions copyright 2001, Autonomous Zones Industries, Inc., all rights... 3 # portions copyright 2001, Autonomous Zones Industries, Inc., all rights...
4 # err... reserved and offered to the public under the terms of the 4 # err... reserved and offered to the public under the terms of the
5 # Python 2.2 license. 5 # Python 2.2 license.
6 # Author: Zooko O'Whielacronx 6 # Author: Zooko O'Whielacronx
7 # http://zooko.com/ 7 # http://zooko.com/
8 # mailto:zooko@zooko.com 8 # mailto:zooko@zooko.com
9 # 9 #
10 # Copyright 2000, Mojam Media, Inc., all rights reserved. 10 # Copyright 2000, Mojam Media, Inc., all rights reserved.
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 if not os.path.exists(dir): 318 if not os.path.exists(dir):
319 os.makedirs(dir) 319 os.makedirs(dir)
320 modulename = _fullmodname(filename) 320 modulename = _fullmodname(filename)
321 321
322 # If desired, get a list of the line numbers which represent 322 # If desired, get a list of the line numbers which represent
323 # executable content (returned as a dict for better lookup speed) 323 # executable content (returned as a dict for better lookup speed)
324 if show_missing: 324 if show_missing:
325 lnotab = _find_executable_linenos(filename) 325 lnotab = _find_executable_linenos(filename)
326 else: 326 else:
327 lnotab = {} 327 lnotab = {}
328 328 if lnotab:
329 source = linecache.getlines(filename) 329 source = linecache.getlines(filename)
330 coverpath = os.path.join(dir, modulename + ".cover") 330 coverpath = os.path.join(dir, modulename + ".cover")
331 with open(filename, 'rb') as fp: 331 with open(filename, 'rb') as fp:
332 encoding, _ = tokenize.detect_encoding(fp.readline) 332 encoding, _ = tokenize.detect_encoding(fp.readline)
333 n_hits, n_lines = self.write_results_file(coverpath, source, 333 n_hits, n_lines = self.write_results_file(coverpath, source,
334 lnotab, count, encoding) 334 lnotab, count, encodin g)
335 if summary and n_lines: 335 if summary and n_lines:
336 percent = int(100 * n_hits / n_lines) 336 percent = int(100 * n_hits / n_lines)
337 sums[modulename] = n_lines, percent, modulename, filename 337 sums[modulename] = n_lines, percent, modulename, filename
338
338 339
339 if summary and sums: 340 if summary and sums:
340 print("lines cov% module (path)") 341 print("lines cov% module (path)")
341 for m in sorted(sums): 342 for m in sorted(sums):
342 n_lines, percent, modulename, filename = sums[m] 343 n_lines, percent, modulename, filename = sums[m]
343 print("%5d %3d%% %s (%s)" % sums[m]) 344 print("%5d %3d%% %s (%s)" % sums[m])
344 345
345 if self.outfile: 346 if self.outfile:
346 # try and store counts and module info into self.outfile 347 # try and store counts and module info into self.outfile
347 try: 348 try:
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 DeprecationWarning, 2) 849 DeprecationWarning, 2)
849 return _find_strings(filename, encoding=None) 850 return _find_strings(filename, encoding=None)
850 851
851 def find_executable_linenos(filename): 852 def find_executable_linenos(filename):
852 _warn("The trace.find_executable_linenos() function is deprecated", 853 _warn("The trace.find_executable_linenos() function is deprecated",
853 DeprecationWarning, 2) 854 DeprecationWarning, 2)
854 return _find_executable_linenos(filename) 855 return _find_executable_linenos(filename)
855 856
856 if __name__=='__main__': 857 if __name__=='__main__':
857 main() 858 main()
OLDNEW
« no previous file with comments | « Lib/test/test_trace.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+