wongyiekheng c92fbe7548 Second Commit
Major refactor of Ameba Control Panel v3.1.0:
- Three-column layout: icon sidebar, config+history, log view
- Dracula PRO theme with light/dark toggle
- DTR/RTS GPIO control (replaces ASCII commands)
- Multi-CDC firmware support for AmebaSmart control device
- Dynamic DUT tabs with +/- management
- NN Model flash image support
- Settings dialog (Font, Serial, Flash, Command tabs)
- Background port scanning, debounced session store
- Adaptive log flush rate, format cache optimization
- Smooth sidebar animation, deferred startup
- pytest test framework with session/log/settings tests
- Thread safety fixes: _alive guards, parented timers, safe baud parsing
- Find highlight: needle-only highlighting with focused match color
- Partial line buffering for table output
- PyInstaller packaging with version stamp and module exclusions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:01:12 +08:00

44 lines
944 B
Python

from __future__ import annotations
import json
import tempfile
from pathlib import Path
import pytest
@pytest.fixture
def tmp_dir(tmp_path):
"""Temporary directory for test files."""
return tmp_path
@pytest.fixture
def session_file(tmp_path):
"""Empty session file path in temp dir."""
return tmp_path / "session.json"
@pytest.fixture
def session_data():
"""Sample session data."""
return {
"_schema_version": 1,
"__tab_list__": [{"key": "dut_1", "label": "DUT 1"}],
"dut_1": {
"dut_port": "COM3",
"dut_baud": 1500000,
"app_path": "/path/to/app.bin",
"app_start_addr": "0x08040000",
"app_end_addr": "0x08440000",
},
}
@pytest.fixture
def corrupt_session_file(tmp_path):
"""Session file with invalid JSON."""
p = tmp_path / "session.json"
p.write_text("{invalid json!!!", encoding="utf-8")
return p