Skip to content

Commit 4088702

Browse files
committed
test: auto test script supports python3
1 parent 1c4d475 commit 4088702

File tree

7 files changed

+19
-7
lines changed

7 files changed

+19
-7
lines changed

examples/bluetooth/nimble/bleprph/bleprph_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
from __future__ import print_function
1818
import os
1919
import re
20-
import Queue
2120
import traceback
2221
import threading
2322
import subprocess
2423

24+
try:
25+
import Queue
26+
except ImportError:
27+
import queue as Queue
28+
2529
from tiny_test_fw import Utility
2630
import ttfw_idf
2731
from ble import lib_ble_client

tools/ble/lib_ble_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
print("Run `pip install -r $IDF_PATH/tools/ble/requirements.txt` for resolving the issue")
3636
raise
3737

38-
import lib_gatt
39-
import lib_gap
38+
from . import lib_gatt
39+
from . import lib_gap
4040

4141
srv_added_old_cnt = 0
4242
srv_added_new_cnt = 0

tools/ci/config/assign-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ assign_test:
1414
EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
1515
TEST_APP_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/tools/test_apps/test_configs"
1616
UNIT_TEST_CASE_FILE: "${CI_PROJECT_DIR}/components/idf_test/unit_test"
17+
# auto_test_script is compatible with Python 3 only
18+
PYTHON_VER: 3
1719
artifacts:
1820
paths:
1921
- components/idf_test/*/CIConfigs

tools/ci/config/target-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@
159159
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
160160
MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
161161
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
162+
# auto_test_script is compatible with Python 3 only
163+
PYTHON_VER: 3
162164
script:
163165
- *define_config_file_name
164166
# first test if config file exists, if not exist, exit 0

tools/ci/python_packages/ttfw_idf/CIAssignExampleTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def format_build_log_path():
6868
job_info_list = gitlab_inst.find_job_id(build_job_name, pipeline_id=pipeline_id)
6969
for job_info in job_info_list:
7070
raw_data = gitlab_inst.download_artifact(job_info["id"], [format_build_log_path()])[0]
71-
build_info_list = [json.loads(line) for line in raw_data.splitlines()]
71+
build_info_list = [json.loads(line) for line in raw_data.decode().splitlines()]
7272
for build_info in build_info_list:
7373
build_info["ci_job_id"] = job_info["id"]
7474
artifact_index_list.append(build_info)

tools/ci/python_packages/ttfw_idf/CIAssignUnitTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def output(self):
127127
"name": test_function,
128128
"extra_data": self._create_extra_data(test_cases, test_function),
129129
"overwrite": overwrite,
130-
} for test_function, test_cases in case_by_test_function.iteritems() if test_cases
130+
} for test_function, test_cases in case_by_test_function.items() if test_cases
131131
],
132132
}
133133
return output_data

tools/ci/setup_python.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#!/usr/bin/env bash
22

3+
# py2_incomp='assign_test|nvs_compatible_test|IT'
4+
# - auto_test_script do not support python2 anymore
5+
# but there are still some jobs incompatible with Python 3 (eg: example_test)
6+
# keep the default python interpreter as 2.7.15 until all the jobs support python3
7+
38
# Regexp for matching job names which are incompatible with Python 3
4-
# - assign_test, nvs_compatible_test, IT - auto_test_script causes the incompatibility
59
# - UT_009_ - multi-device tests are not compatible
610
# - UT_014_ - multi-device tests are not compatible
711
# - UT_017_ - multi-device tests are not compatible
8-
py3_incomp='assign_test|nvs_compatible_test|IT|UT_009_|UT_013_|UT_014_|UT_017_'
12+
py3_incomp='UT_009_|UT_013_|UT_014_|UT_017_'
913

1014
if [ -z ${PYTHON_VER+x} ] || [[ $CI_JOB_NAME =~ $py3_incomp ]]; then
1115
# Use this version of the Python interpreter if it was not defined before or

0 commit comments

Comments
 (0)