2022-03-04 10:04:20 +00:00
|
|
|
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
# SPDX-License-Identifier: CC0-1.0
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
from pytest_embedded.dut import Dut
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.esp32s2
|
|
|
|
@pytest.mark.esp32c3
|
|
|
|
@pytest.mark.esp32s3
|
2022-06-14 06:50:35 +00:00
|
|
|
@pytest.mark.esp32c2
|
2022-03-04 10:04:20 +00:00
|
|
|
@pytest.mark.generic
|
|
|
|
def test_temp_sensor_example(dut: Dut) -> None:
|
2022-04-24 10:14:17 +00:00
|
|
|
dut.expect_exact('Install temperature sensor')
|
|
|
|
dut.expect_exact('Enable temperature sensor')
|
|
|
|
dut.expect_exact('Read temperature')
|
|
|
|
temp_value = dut.expect(r'Temperature value (\d+\.\d+) .*', timeout=5)
|
2022-03-04 10:04:20 +00:00
|
|
|
# Because the example test only run in the normal temperature environment. So this assert range is meaningful
|
2022-04-24 10:14:17 +00:00
|
|
|
assert 0 < float(temp_value.group(1).decode('utf8')) < 50
|
|
|
|
temp_value = dut.expect(r'Temperature value (\d+\.\d+) .*', timeout=5)
|
|
|
|
assert 0 < float(temp_value.group(1).decode('utf8')) < 50
|