From: morris Date: Thu, 29 Nov 2018 12:34:57 +0000 (+0800) Subject: example_test: using try block to pass the python style check X-Git-Tag: v3.3-beta1~44^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9163e454f153974d608bf5bf4bf35d0ce0a82410;p=esp-idf example_test: using try block to pass the python style check --- diff --git a/examples/peripherals/i2c/i2c_tools/example_test.py b/examples/peripherals/i2c/i2c_tools/example_test.py index 2e8a109f74..a42a0f0740 100644 --- a/examples/peripherals/i2c/i2c_tools/example_test.py +++ b/examples/peripherals/i2c/i2c_tools/example_test.py @@ -1,14 +1,17 @@ from __future__ import print_function import os import sys -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 TinyFW -import IDF EXPECT_TIMEOUT = 20 +try: + import IDF +except ImportError: + 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 + @IDF.idf_example_test(env_tag='Example_I2C_CCS811_SENSOR') def test_i2ctools_example(env, extra_data):