From 0abca0f81735aad897a4a5e70459ae4c196fd3c7 Mon Sep 17 00:00:00 2001 From: Orual Date: Mon, 23 Feb 2026 23:27:39 -0500 Subject: [PATCH] fix: remove swallowed AssertionError in debounce test and unused pytest import --- tests/test_dfgraph_server.py | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/tests/test_dfgraph_server.py b/tests/test_dfgraph_server.py index b26add4..61bb930 100644 --- a/tests/test_dfgraph_server.py +++ b/tests/test_dfgraph_server.py @@ -7,7 +7,6 @@ Tests verify: import time -import pytest from starlette.testclient import TestClient from dfgraph.server import create_app @@ -146,30 +145,21 @@ class TestLiveReload: # Give debounce time to trigger (300ms debounce + buffer) time.sleep(0.5) - # Try to receive a message within a 2-second window - # The debounce mechanism should have collapsed 3 rapid changes into 1 update - try: - start = time.time() - received_updates = [] - while time.time() - start < 2.0: - try: - data = ws.receive_json() - if data.get("type") == "graph_update": - received_updates.append(data) - # Break after getting the first debounced update - break - except Exception: - # Connection closed or other error + # Collect updates within a 2-second window + start = time.time() + received_updates = [] + while time.time() - start < 2.0: + try: + data = ws.receive_json() + if data.get("type") == "graph_update": + received_updates.append(data) break + except Exception: + break - # Should have received at least one update (3 rapid changes debounced to 1) - assert len(received_updates) >= 1, ( - f"Expected at least 1 debounced update, got {len(received_updates)}" - ) - except Exception as e: - # If the connection closes or there's a timeout, that's acceptable - # The important thing is that the debounce mechanism is in place - pass + assert len(received_updates) >= 1, ( + f"Expected at least 1 debounced update, got {len(received_updates)}" + ) class TestHttpServing: -- 2.51.2