From ab14b581cb2ccd8e081362f575eba1b3e4d0aa26 Mon Sep 17 00:00:00 2001 From: Nikolai Limbrunner Date: Tue, 22 Feb 2022 19:57:36 +0100 Subject: [PATCH] Fix: write only new called lines into log (#25) --- setup.py | 2 +- simple_coverage/output.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 52aaec9..afdcf6f 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="simple_coverage", - version="0.3.0", + version="0.3.1", author="Nikolai Limbrunner", author_email="nikolai.limbrunner@gmail.com", description="Simple Coverage measurements for Python", diff --git a/simple_coverage/output.py b/simple_coverage/output.py index 00bbc60..e365951 100644 --- a/simple_coverage/output.py +++ b/simple_coverage/output.py @@ -30,8 +30,10 @@ def save_coverage_output(func_name, instructions_dict, called_instructions): # check if function already exists if func_name in data: - # append called instructions to existing function - data[func_name]["called_instructions"].extend(called_instructions) + # append new called instructions to existing function + for instruction in called_instructions: + if instruction not in data[func_name]["called_instructions"]: + data[func_name]["called_instructions"].append(instruction) else: # otherwise create new entry for new function data.update(