pytest_temp_sensor_example.py 634 B

1234567891011121314151617
  1. # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: CC0-1.0
  3. import pytest
  4. from pytest_embedded.dut import Dut
  5. @pytest.mark.esp32s2
  6. @pytest.mark.esp32c3
  7. @pytest.mark.esp32s3
  8. @pytest.mark.generic
  9. def test_temp_sensor_example(dut: Dut) -> None:
  10. dut.expect_exact('Initializing Temperature sensor')
  11. dut.expect_exact('Temperature sensor started')
  12. temp_value = dut.expect(r'Temperature out celsius (\d+\.\d+)', timeout=30)
  13. # Because the example test only run in the normal temperature environment. So this assert range is meaningful
  14. assert 0 < float(temp_value.group(1)) < 45