From bc1d74bb880c0cc11fdf14f81e5ee48990971f9d Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Wed, 29 Nov 2023 10:43:19 +0100 Subject: [PATCH] fix(ci): Remove unittest-xml-reporting dependency from host tests --- .gitlab/ci/host-test.yml | 18 +++++++++--------- .gitlab/ci/rules.yml | 2 +- tools/ci/executable-list.txt | 2 +- tools/ci/mypy_ignore_list.txt | 1 - tools/ci/test_autocomplete/pytest.ini | 12 ++++++++++++ .../test_autocomplete.py | 4 ++-- tools/requirements/requirements.ci.txt | 1 - tools/test_idf_py/pytest.ini | 12 ++++++++++++ tools/test_mkdfu/pytest.ini | 12 ++++++++++++ 9 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 tools/ci/test_autocomplete/pytest.ini rename tools/ci/{ => test_autocomplete}/test_autocomplete.py (95%) create mode 100644 tools/test_idf_py/pytest.ini create mode 100644 tools/test_mkdfu/pytest.ini diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index c3a6f87ce2..d83cfe4a87 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -205,19 +205,19 @@ test_tools: LC_ALL: C.UTF-8 script: - stat=0 - - cd ${IDF_PATH}/tools/ci - - python -m xmlrunner test_autocomplete.py --output-file=${IDF_PATH}/XUNIT_AUTOCOMP.xml || stat=1 + - cd ${IDF_PATH}/tools/ci/test_autocomplete + - pytest --noconftest test_autocomplete.py --junitxml=${IDF_PATH}/XUNIT_AUTOCOMP.xml || stat=1 - cd ${IDF_PATH}/tools/test_idf_py - - python -m xmlrunner test_idf_py.py --output-file=${IDF_PATH}/XUNIT_IDF_PY.xml || stat=1 - - python -m xmlrunner test_hints.py --output-file=${IDF_PATH}/XUNIT_HINTS.xml || stat=1 + - pytest --noconftest test_idf_py.py --junitxml=${IDF_PATH}/XUNIT_IDF_PY.xml || stat=1 + - pytest --noconftest test_hints.py --junitxml=${IDF_PATH}/XUNIT_HINTS.xml || stat=1 - cd ${IDF_PATH}/tools/test_mkdfu - - python -m xmlrunner test_mkdfu.py --output-file=${IDF_PATH}/XUNIT_MKDFU.xml || stat=1 + - pytest --noconftest test_mkdfu.py --junitxml=${IDF_PATH}/XUNIT_MKDFU.xml || stat=1 - cd ${IDF_PATH}/tools/test_sbom - - pytest --junitxml=${IDF_PATH}/XUNIT_SBOM.xml || stat=1 + - pytest --junitxml=${IDF_PATH}/XUNIT_SBOM.xml || stat=1 - cd ${IDF_PATH} - - shellcheck -s sh tools/detect_python.sh || stat=1 - - shellcheck -s bash tools/detect_python.sh || stat=1 - - shellcheck -s dash tools/detect_python.sh || stat=1 + - shellcheck -s sh tools/detect_python.sh || stat=1 + - shellcheck -s bash tools/detect_python.sh || stat=1 + - shellcheck -s dash tools/detect_python.sh || stat=1 - "bash -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'" - "dash -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'" - "zsh -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'" diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index 3fbbeeceeb..e9998bc008 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -126,7 +126,7 @@ - "components/**/*" - - "tools/ci/test_autocomplete.py" + - "tools/ci/test_autocomplete/*" - "tools/mass_mfg/**/*" diff --git a/tools/ci/executable-list.txt b/tools/ci/executable-list.txt index f0a4a6691d..d5716e7b56 100644 --- a/tools/ci/executable-list.txt +++ b/tools/ci/executable-list.txt @@ -77,7 +77,7 @@ tools/ci/get_supported_examples.sh tools/ci/mirror-submodule-update.sh tools/ci/multirun_with_pyenv.sh tools/ci/push_to_github.sh -tools/ci/test_autocomplete.py +tools/ci/test_autocomplete/test_autocomplete.py tools/ci/test_configure_ci_environment.sh tools/ci/test_reproducible_build.sh tools/docker/entrypoint.sh diff --git a/tools/ci/mypy_ignore_list.txt b/tools/ci/mypy_ignore_list.txt index b7227a91a2..af0bac210d 100644 --- a/tools/ci/mypy_ignore_list.txt +++ b/tools/ci/mypy_ignore_list.txt @@ -34,7 +34,6 @@ tools/ci/python_packages/idf_iperf_test_util/LineChart.py tools/ci/python_packages/idf_iperf_test_util/PowerControl.py tools/ci/python_packages/idf_iperf_test_util/TestReport.py tools/ci/python_packages/wifi_tools.py -tools/ci/test_autocomplete.py tools/esp_app_trace/espytrace/apptrace.py tools/esp_app_trace/espytrace/sysview.py tools/esp_app_trace/logtrace_proc.py diff --git a/tools/ci/test_autocomplete/pytest.ini b/tools/ci/test_autocomplete/pytest.ini new file mode 100644 index 0000000000..d95e773e5c --- /dev/null +++ b/tools/ci/test_autocomplete/pytest.ini @@ -0,0 +1,12 @@ +[pytest] +addopts = -s -p no:pytest_embedded + +# log related +log_cli = True +log_cli_level = INFO +log_cli_format = %(asctime)s %(levelname)s %(message)s +log_cli_date_format = %Y-%m-%d %H:%M:%S + +## log all to `system-out` when case fail +junit_logging = stdout +junit_log_passing_tests = False diff --git a/tools/ci/test_autocomplete.py b/tools/ci/test_autocomplete/test_autocomplete.py similarity index 95% rename from tools/ci/test_autocomplete.py rename to tools/ci/test_autocomplete/test_autocomplete.py index 36dfe00c22..49fe24be62 100755 --- a/tools/ci/test_autocomplete.py +++ b/tools/ci/test_autocomplete/test_autocomplete.py @@ -20,7 +20,7 @@ TESTS = (Test('fish', 'vt100', 'all.*app.*app-flash.*bootloader.*', 'fish'), pargs = (pexpect.EOF, pexpect.TIMEOUT) -def get_fail_msg(pproc, msg, index): +def get_fail_msg(pproc: pexpect.spawn, msg: str, index: int) -> str: try: buf = pproc._buffer.getvalue() except AttributeError: @@ -33,7 +33,7 @@ def get_fail_msg(pproc, msg, index): class UTTest(unittest.TestCase): - def test_shell(self): + def test_shell(self) -> None: idf_path = os.environ['IDF_PATH'] env = os.environ.copy() for test in TESTS: diff --git a/tools/requirements/requirements.ci.txt b/tools/requirements/requirements.ci.txt index 838ecc0810..0e5c231133 100644 --- a/tools/requirements/requirements.ci.txt +++ b/tools/requirements/requirements.ci.txt @@ -11,4 +11,3 @@ pyyaml SimpleWebSocketServer pylint-gitlab minio -unittest-xml-reporting diff --git a/tools/test_idf_py/pytest.ini b/tools/test_idf_py/pytest.ini new file mode 100644 index 0000000000..d95e773e5c --- /dev/null +++ b/tools/test_idf_py/pytest.ini @@ -0,0 +1,12 @@ +[pytest] +addopts = -s -p no:pytest_embedded + +# log related +log_cli = True +log_cli_level = INFO +log_cli_format = %(asctime)s %(levelname)s %(message)s +log_cli_date_format = %Y-%m-%d %H:%M:%S + +## log all to `system-out` when case fail +junit_logging = stdout +junit_log_passing_tests = False diff --git a/tools/test_mkdfu/pytest.ini b/tools/test_mkdfu/pytest.ini new file mode 100644 index 0000000000..d95e773e5c --- /dev/null +++ b/tools/test_mkdfu/pytest.ini @@ -0,0 +1,12 @@ +[pytest] +addopts = -s -p no:pytest_embedded + +# log related +log_cli = True +log_cli_level = INFO +log_cli_format = %(asctime)s %(levelname)s %(message)s +log_cli_date_format = %Y-%m-%d %H:%M:%S + +## log all to `system-out` when case fail +junit_logging = stdout +junit_log_passing_tests = False