Ignore code which coverage can't analyze (#82125)

* Ignore code which coverage can't analyze

Our own tracing function can't be traced.

* Use `nocover` instead of `no cover` for consistency
pull/82129/head
Matt Clay 1 year ago committed by GitHub
parent f8a9fd4758
commit 1df791cd90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -406,7 +406,7 @@ def test_import_from_collection(monkeypatch):
original_trace_function = sys.gettrace()
trace_log = []
if original_trace_function:
if original_trace_function: # pragma: nocover
# enable tracing while preserving the existing trace function (coverage)
def my_trace_function(frame, event, arg):
trace_log.append((frame.f_code.co_filename, frame.f_lineno, event))
@ -419,7 +419,7 @@ def test_import_from_collection(monkeypatch):
sys.settrace(my_trace_function)
return my_trace_function
else:
else: # pragma: nocover
# no existing trace function, so our trace function is much simpler
def my_trace_function(frame, event, arg):
trace_log.append((frame.f_code.co_filename, frame.f_lineno, event))

Loading…
Cancel
Save