forked from iarv/Akita-Meshtastic-Meshcore-Bridge
- Introduced `test_meshcore.py` with extensive unit tests for: - RawSerialProtocol and MeshcoreCompanionProtocol - MessageValidator - MeshcoreHandler and MeshcoreAsyncHandler - Enhanced `conftest.py` to include new configuration option `SERIAL_AUTO_SWITCH`. - Verified encoding and decoding processes for various message types. - Ensured proper handling of edge cases and error conditions.
23 lines
634 B
Python
23 lines
634 B
Python
import configparser
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(scope="function")
|
|
def temp_config_file(tmp_path):
|
|
config_path = tmp_path / "config.ini"
|
|
parser = configparser.ConfigParser()
|
|
parser["DEFAULT"] = {
|
|
"MESHTASTIC_SERIAL_PORT": "/dev/test_meshtastic",
|
|
"EXTERNAL_TRANSPORT": "serial",
|
|
"SERIAL_PORT": "/dev/test_meshcore",
|
|
"SERIAL_BAUD_RATE": "19200",
|
|
"SERIAL_PROTOCOL": "json_newline",
|
|
"MESSAGE_QUEUE_SIZE": "50",
|
|
"LOG_LEVEL": "DEBUG",
|
|
"SERIAL_AUTO_SWITCH": "True",
|
|
}
|
|
with open(config_path, "w") as f:
|
|
parser.write(f)
|
|
yield str(config_path)
|