From 7d7158c33ffa83169f71a736951760a79e375661 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 21:22:56 +0000 Subject: [PATCH 1/2] Initial plan From eef1a4335340a47424d003e00ee27a840091e4f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 21:40:06 +0000 Subject: [PATCH 2/2] Optimize pytest duplicate check from O(n) to O(1) by using set instead of list Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> --- python_files/vscode_pytest/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python_files/vscode_pytest/__init__.py b/python_files/vscode_pytest/__init__.py index ba8b270403ac..88238a201acb 100644 --- a/python_files/vscode_pytest/__init__.py +++ b/python_files/vscode_pytest/__init__.py @@ -75,7 +75,7 @@ def __init__(self, message): ERRORS = [] IS_DISCOVERY = False map_id_to_path = {} -collected_tests_so_far = [] +collected_tests_so_far = set() TEST_RUN_PIPE = os.getenv("TEST_RUN_PIPE") SYMLINK_PATH = None INCLUDE_BRANCHES = False @@ -170,7 +170,7 @@ def pytest_exception_interact(node, call, report): report_value = "failure" node_id = get_absolute_test_id(node.nodeid, get_node_path(node)) if node_id not in collected_tests_so_far: - collected_tests_so_far.append(node_id) + collected_tests_so_far.add(node_id) item_result = create_test_outcome( node_id, report_value, @@ -295,7 +295,7 @@ def pytest_report_teststatus(report, config): # noqa: ARG001 # Calculate the absolute test id and use this as the ID moving forward. absolute_node_id = get_absolute_test_id(report.nodeid, node_path) if absolute_node_id not in collected_tests_so_far: - collected_tests_so_far.append(absolute_node_id) + collected_tests_so_far.add(absolute_node_id) item_result = create_test_outcome( absolute_node_id, report_value, @@ -329,7 +329,7 @@ def pytest_runtest_protocol(item, nextitem): # noqa: ARG001 report_value = "skipped" cwd = pathlib.Path.cwd() if absolute_node_id not in collected_tests_so_far: - collected_tests_so_far.append(absolute_node_id) + collected_tests_so_far.add(absolute_node_id) item_result = create_test_outcome( absolute_node_id, report_value,