Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: tools/telemetry/third_party/coverage/tests/farm/run/src/showtrace.py

Issue 1366913004: Add coverage Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
3
4 # Show the current frame's trace function, so that we can test what the
5 # command-line options do to the trace function used.
6
7 import sys
8
9 # Show what the trace function is. If a C-based function is used, then f_trace
10 # may be None.
11 trace_fn = sys._getframe(0).f_trace
12 if trace_fn is None:
13 trace_name = "None"
14 else:
15 # Get the name of the tracer class. Py3k has a different way to get it.
16 try:
17 trace_name = trace_fn.im_class.__name__
18 except AttributeError:
19 try:
20 trace_name = trace_fn.__self__.__class__.__name__
21 except AttributeError:
22 # A C-based function could also manifest as an f_trace value
23 # which doesn't have im_class or __self__.
24 trace_name = trace_fn.__class__.__name__
25
26 print("%s %s" % (sys.argv[1], trace_name))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698