pytest_parttool_example.py 876 B

12345678910111213141516171819202122232425262728
  1. # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Unlicense OR CC0-1.0
  3. import os
  4. import subprocess
  5. import sys
  6. import pytest
  7. from pytest_embedded import Dut
  8. @pytest.mark.esp32
  9. @pytest.mark.esp32c3
  10. def test_examples_parttool(dut: Dut) -> None:
  11. # Verify factory firmware
  12. dut.expect('Partitions Tool Example')
  13. dut.expect('Example end')
  14. # Close connection to DUT
  15. dut.pexpect_proc.terminate()
  16. dut.serial.stop_redirect_thread()
  17. # Run the example python script
  18. idf_path = os.getenv('IDF_PATH')
  19. assert idf_path is not None
  20. script_path = os.path.join(idf_path, 'examples', 'storage', 'parttool', 'parttool_example.py')
  21. binary_path = os.path.join(dut.app.binary_path, 'parttool.bin')
  22. subprocess.check_call([sys.executable, script_path, '--binary', binary_path, '--port', dut.serial.port])