forked from espressif/esp-modbus
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@c906e2afee
This commit is contained in:
@@ -2,20 +2,11 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
try:
|
import ttfw_idf
|
||||||
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
|
|
||||||
|
|
||||||
LOG_LEVEL = logging.DEBUG
|
LOG_LEVEL = logging.DEBUG
|
||||||
LOGGER_NAME = "modbus_test"
|
LOGGER_NAME = "modbus_test"
|
||||||
@@ -174,13 +165,13 @@ def test_check_mode(dut=None, mode_str=None, value=None):
|
|||||||
return False
|
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):
|
def test_modbus_communication(env, comm_mode):
|
||||||
global logger
|
global logger
|
||||||
|
|
||||||
# Get device under test. "dut1 - master", "dut2 - slave" must be properly connected through RS485 interface driver
|
# 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_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_slave = env.get_dut("modbus_slave", "examples/protocols/modbus/serial/mb_slave", dut_class=ttfw_idf.ESP32DUT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logger.debug("Environment vars: %s\r\n" % os.environ)
|
logger.debug("Environment vars: %s\r\n" % os.environ)
|
||||||
|
Reference in New Issue
Block a user