From 8acd852de3faab4406bc05abf312ed18ed2985ca Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 28 Sep 2018 19:27:41 -0400 Subject: Move the context determiner to its own file --- coverage/context.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 coverage/context.py (limited to 'coverage/context.py') diff --git a/coverage/context.py b/coverage/context.py new file mode 100644 index 00000000..24d01f2a --- /dev/null +++ b/coverage/context.py @@ -0,0 +1,11 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt + +"""Determine contexts for coverage.py""" + +def should_start_context_test_function(frame): + """Is this frame calling a test_* function?""" + fn_name = frame.f_code.co_name + if fn_name.startswith("test"): + return fn_name + return None -- cgit v1.2.1