diff --git a/cov/cov.py b/cov/cov.py index f76eef41e4f0..1cc1b2fbc601 100644 --- a/cov/cov.py +++ b/cov/cov.py @@ -29,13 +29,13 @@ def decorator(func: Callable) -> Callable: return decorator -def mark(branch_id: int, func_name = None) -> None: - if func_name is None: - func_name = inspect.stack()[1].function +def mark(branch_id: int) -> None: + for frame in inspect.stack(): + if frame.function in coverages: + coverage = coverages[frame.function] - coverage = coverages[func_name] - - coverage.covered_branches[branch_id] = True + coverage.covered_branches[branch_id] = True + break def print_table() -> None: