mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	preen
This commit is contained in:
		| @@ -6,7 +6,9 @@ host: | |||||||
| api: | api: | ||||||
|  |  | ||||||
| logger: | logger: | ||||||
|   level: INFO |   level: DEBUG | ||||||
|  |   logs: | ||||||
|  |     runtime_stats: INFO | ||||||
|  |  | ||||||
| runtime_stats: | runtime_stats: | ||||||
|   log_interval: 1s |   log_interval: 1s | ||||||
|   | |||||||
| @@ -27,18 +27,18 @@ async def test_runtime_stats( | |||||||
|     # Track component stats |     # Track component stats | ||||||
|     component_stats_found = set() |     component_stats_found = set() | ||||||
|  |  | ||||||
|     # Patterns to match |     # Patterns to match - need to handle ANSI color codes and timestamps | ||||||
|  |     # The log format is: [HH:MM:SS][color codes][I][tag]: message | ||||||
|     total_stats_pattern = re.compile(r"Total stats \(since boot\):") |     total_stats_pattern = re.compile(r"Total stats \(since boot\):") | ||||||
|     component_pattern = re.compile(r"^\s+(\w+):\s+count=(\d+),\s+avg=([\d.]+)ms") |     # Match component names that may include dots (e.g., template.sensor) | ||||||
|  |     component_pattern = re.compile( | ||||||
|  |         r"^\[[^\]]+\].*?\s+([\w.]+):\s+count=(\d+),\s+avg=([\d.]+)ms" | ||||||
|  |     ) | ||||||
|  |  | ||||||
|     def check_output(line: str) -> None: |     def check_output(line: str) -> None: | ||||||
|         """Check log output for runtime stats messages.""" |         """Check log output for runtime stats messages.""" | ||||||
|         nonlocal stats_count |         nonlocal stats_count | ||||||
|  |  | ||||||
|         # Debug: print ALL lines to see what we're getting |  | ||||||
|         if "[I]" in line or "[D]" in line or "[W]" in line or "[E]" in line: |  | ||||||
|             print(f"LOG: {line}") |  | ||||||
|  |  | ||||||
|         # Check for total stats line |         # Check for total stats line | ||||||
|         if total_stats_pattern.search(line): |         if total_stats_pattern.search(line): | ||||||
|             stats_count += 1 |             stats_count += 1 | ||||||
| @@ -80,9 +80,9 @@ async def test_runtime_stats( | |||||||
|             ) |             ) | ||||||
|  |  | ||||||
|             # Verify we found stats for our components |             # Verify we found stats for our components | ||||||
|             assert "sensor" in component_stats_found, ( |             assert "template.sensor" in component_stats_found, ( | ||||||
|                 f"Expected sensor stats, found: {component_stats_found}" |                 f"Expected template.sensor stats, found: {component_stats_found}" | ||||||
|             ) |             ) | ||||||
|             assert "switch" in component_stats_found, ( |             assert "template.switch" in component_stats_found, ( | ||||||
|                 f"Expected switch stats, found: {component_stats_found}" |                 f"Expected template.switch stats, found: {component_stats_found}" | ||||||
|             ) |             ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user