• Home
  • Raw
  • Download

Lines Matching +full:results +full:- +full:code

16 # Copyright 1995-1997, Automatrix, Inc., all rights reserved.
19 # Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.
33 trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs
34 trace.py -t --ignore-dir '$prefix' spam.py eggs
35 trace.py --trackcalls spam.py eggs
41 # do tracing or line-counting or both.
47 r = tracer.results()
98 # must be a built-in, so we must ignore
207 Write the coverage results.
211 :param coverdir: If None, the results of each module are placed in its
235 print(" -->", cfile)
237 print(" %s.%s -> %s.%s" % (pmod, pfunc, cmod, cfunc))
240 # accessible on a per-file basis
254 filename = filename[:-1]
298 """Return a coverage results file in path."""
305 "- skipping" % (path, err)), file=sys.stderr)
319 # Highlight never-executed lines, unless the line contains
329 def _find_lines_from_code(code, strs): argument
333 for _, lineno in dis.findlinestarts(code):
339 def _find_lines(code, strs): argument
340 """Return lineno dict for all code objects reachable from code."""
341 # get all of the lineno information from the code of this scope level
342 linenos = _find_lines_from_code(code, strs)
344 # and check the constants for references to other code objects
345 for c in code.co_consts:
347 # find another code object, so recurse into it
355 line that contains only a string or a part of a triple-quoted
384 code = compile(prog, filename, "exec")
386 return _find_lines(code, strs)
405 added into the results
406 @param outfile file in which to write the results
436 # Ahem -- do nothing? Okay.
469 code = frame.f_code
470 filename = code.co_filename
476 funcname = code.co_name
478 if code in self._caller_cache:
479 if self._caller_cache[code] is not None:
480 clsname = self._caller_cache[code]
482 self._caller_cache[code] = None
484 # all functions which refer to this code object
485 funcs = [f for f in gc.get_referrers(code)
499 # cache the result - assumption is that new.* is
503 self._caller_cache[code] = clsname
532 If the code block being entered is to be ignored, returns `None',
536 code = frame.f_code
546 print((" --- modulename: %s, funcname: %s"
547 % (modulename, code.co_name)))
561 print('%.2f' % (_time() - self.start_time), end=' ')
574 print('%.2f' % (_time() - self.start_time), end=' ')
588 def results(self): member in Trace
598 parser.add_argument('--version', action='version', version='trace 2.0')
601 'One of these (or --report) must be given')
603 grp.add_argument('-c', '--count', action='store_true',
606 'the module\'s directory. See also --coverdir, --file, '
607 '--no-report below.')
608 grp.add_argument('-t', '--trace', action='store_true',
610 grp.add_argument('-l', '--listfuncs', action='store_true',
612 'and write the results to sys.stdout after the program exits. '
613 'Cannot be specified alongside --trace or --count.')
614 grp.add_argument('-T', '--trackcalls', action='store_true',
615 help='Keep track of caller/called pairs and write the results to '
621 _grp.add_argument('-r', '--report', action='store_true',
623 'code. --file must specify the results file to read, which '
624 'must have been created in a previous run with --count '
625 '--file=FILE')
626 _grp.add_argument('-R', '--no-report', action='store_true',
630 grp.add_argument('-f', '--file',
632 grp.add_argument('-C', '--coverdir',
636 grp.add_argument('-m', '--missing', action='store_true',
639 grp.add_argument('-s', '--summary', action='store_true',
641 'Can only be used with --count or --report')
642 grp.add_argument('-g', '--timing', action='store_true',
648 grp.add_argument('--ignore-module', action='append', default=[],
652 grp.add_argument('--ignore-dir', action='append', default=[],
656 parser.add_argument('--module', action='store_true', default=False,
681 parser.error('-r/--report requires -f/--file')
682 results = CoverageResults(infile=opts.file, outfile=opts.file)
683 return results.write_results(opts.missing, opts.summary, opts.coverdir)
686 parser.error('must specify one of --trace, --count, --report, '
687 '--listfuncs, or --trackcalls')
690 parser.error('cannot specify both --listfuncs and (--trace or --count)')
693 parser.error('--summary can only be used with --count or --report')
706 mod_name, mod_spec, code = runpy._get_module_details(module_name)
707 sys.argv = [code.co_filename, *opts.arguments]
710 '__file__': code.co_filename,
721 code = compile(fp.read(), opts.progname, 'exec')
729 t.runctx(code, globs, globs)
735 results = t.results()
738 results.write_results(opts.missing, opts.summary, opts.coverdir)