From 160d99ff15559fdb7fdd234f96d475bdda9a6e78 Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Wed, 27 Nov 2019 11:58:07 +0800 Subject: [PATCH] test: update example and unit tests with new import roles: tiny_test_fw is a python package now. import it using normal way. * Original commit: espressif/esp-idf@c906e2afee9455bf55b7b163815dce69de766879 --- .../protocols/modbus/serial/example_test.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/examples/protocols/modbus/serial/example_test.py b/examples/protocols/modbus/serial/example_test.py index e1ffa97..0902e1c 100644 --- a/examples/protocols/modbus/serial/example_test.py +++ b/examples/protocols/modbus/serial/example_test.py @@ -2,20 +2,11 @@ from __future__ import print_function import os -import sys import re import logging from threading import Thread -try: - import IDF -except ImportError: - # The test cause is dependent on the Tiny Test Framework. Ensure the - # `TEST_FW_PATH` environment variable is set to `$IDF_PATH/tools/tiny-test-fw` - test_fw_path = os.getenv("TEST_FW_PATH") - if test_fw_path and test_fw_path not in sys.path: - sys.path.insert(0, test_fw_path) - import IDF +import ttfw_idf LOG_LEVEL = logging.DEBUG LOGGER_NAME = "modbus_test" @@ -174,13 +165,13 @@ def test_check_mode(dut=None, mode_str=None, value=None): return False -@IDF.idf_example_test(env_tag='Example_T2_RS485') +@ttfw_idf.idf_example_test(env_tag='Example_T2_RS485') def test_modbus_communication(env, comm_mode): global logger # Get device under test. "dut1 - master", "dut2 - slave" must be properly connected through RS485 interface driver - dut_master = env.get_dut("modbus_master", "examples/protocols/modbus/serial/mb_master") - dut_slave = env.get_dut("modbus_slave", "examples/protocols/modbus/serial/mb_slave") + dut_master = env.get_dut("modbus_master", "examples/protocols/modbus/serial/mb_master", dut_class=ttfw_idf.ESP32DUT) + dut_slave = env.get_dut("modbus_slave", "examples/protocols/modbus/serial/mb_slave", dut_class=ttfw_idf.ESP32DUT) try: logger.debug("Environment vars: %s\r\n" % os.environ)