mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	preen
This commit is contained in:
		| @@ -58,7 +58,8 @@ async def test_defer_fifo_simple( | |||||||
|         # Get the event loop |         # Get the event loop | ||||||
|         loop = asyncio.get_running_loop() |         loop = asyncio.get_running_loop() | ||||||
|  |  | ||||||
|         # Subscribe to states (events are delivered as EventStates through subscribe_states) |         # Subscribe to states | ||||||
|  |         # (events are delivered as EventStates through subscribe_states) | ||||||
|         test_complete_future: asyncio.Future[bool] = loop.create_future() |         test_complete_future: asyncio.Future[bool] = loop.create_future() | ||||||
|         test_result_future: asyncio.Future[bool] = loop.create_future() |         test_result_future: asyncio.Future[bool] = loop.create_future() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -58,7 +58,8 @@ async def test_defer_stress( | |||||||
|         # Check FIFO ordering within thread |         # Check FIFO ordering within thread | ||||||
|         if thread_executions[thread_id] and thread_executions[thread_id][-1] >= index: |         if thread_executions[thread_id] and thread_executions[thread_id][-1] >= index: | ||||||
|             fifo_violations.append( |             fifo_violations.append( | ||||||
|                 f"Thread {thread_id}: index {index} executed after {thread_executions[thread_id][-1]}" |                 f"Thread {thread_id}: index {index} executed after " | ||||||
|  |                 f"{thread_executions[thread_id][-1]}" | ||||||
|             ) |             ) | ||||||
|  |  | ||||||
|         thread_executions[thread_id].append(index) |         thread_executions[thread_id].append(index) | ||||||
| @@ -99,8 +100,9 @@ async def test_defer_stress( | |||||||
|         except asyncio.TimeoutError: |         except asyncio.TimeoutError: | ||||||
|             # Report how many we got |             # Report how many we got | ||||||
|             pytest.fail( |             pytest.fail( | ||||||
|                 f"Stress test timed out. Only {len(executed_defers)} of 1000 defers executed. " |                 f"Stress test timed out. Only {len(executed_defers)} of " | ||||||
|                 f"Missing IDs: {sorted(set(range(1000)) - executed_defers)[:10]}..." |                 f"1000 defers executed. Missing IDs: " | ||||||
|  |                 f"{sorted(set(range(1000)) - executed_defers)[:10]}..." | ||||||
|             ) |             ) | ||||||
|  |  | ||||||
|         # Verify all defers executed |         # Verify all defers executed | ||||||
| @@ -130,5 +132,6 @@ async def test_defer_stress( | |||||||
|  |  | ||||||
|         # If we got here without crashing and with proper ordering, the test passed |         # If we got here without crashing and with proper ordering, the test passed | ||||||
|         assert True, ( |         assert True, ( | ||||||
|             "Test completed successfully - all 1000 defers executed with FIFO ordering preserved" |             "Test completed successfully - all 1000 defers executed with " | ||||||
|  |             "FIFO ordering preserved" | ||||||
|         ) |         ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user