feat: split pytest requirements to base and test-specific

This commit is contained in:
Fu Hanxi 2024-09-10 10:13:57 +02:00
parent 1889851d7c
commit dca0465095
7 changed files with 44 additions and 25 deletions

View File

@ -147,16 +147,16 @@ variables:
# install latest python packages
# target test jobs
if [[ "${CI_JOB_STAGE}" == "target_test" ]]; then
run_cmd bash install.sh --enable-ci --enable-pytest
run_cmd bash install.sh --enable-ci --enable-pytest --enable-test-specific
elif [[ "${CI_JOB_STAGE}" == "build_doc" ]]; then
run_cmd bash install.sh --enable-ci --enable-docs
elif [[ "${CI_JOB_STAGE}" == "build" ]]; then
run_cmd bash install.sh --enable-ci --enable-pytest
run_cmd bash install.sh --enable-ci
else
if ! echo "${CI_JOB_NAME}" | egrep ".*pytest.*"; then
run_cmd bash install.sh --enable-ci
else
run_cmd bash install.sh --enable-ci --enable-pytest
run_cmd bash install.sh --enable-ci --enable-pytest --enable-test-specific
fi
fi

View File

@ -33,12 +33,18 @@ On the host side, ESP-IDF employs the pytest framework (alongside certain pytest
Installation
============
All dependencies could be installed by running the ESP-IDF install script with the ``--enable-pytest`` argument:
All basic dependencies could be installed by running the ESP-IDF install script with the ``--enable-pytest`` argument:
.. code-block:: bash
$ install.sh --enable-pytest
Additional test script specific dependencies could be installed separately by running the ESP-IDF install script with the ``--enable-pytest-specific`` argument:
.. code-block:: bash
$ install.sh --enable-test-specific
Several mechanisms have been implemented to ensure the successful execution of the installation processes. If you encounter any issues during installation, please submit an issue report to our `GitHub issue tracker <https://github.com/espressif/esp-idf/issues>`__.
Common Concepts

View File

@ -33,12 +33,18 @@ ESP-IDF 在主机端使用 pytest 框架(以及一些 pytest 插件)来自
安装
============
所有依赖项都可以通过执行 ESP-IDF 安装脚本 ``--enable-pytest`` 进行安装:
基础依赖项可以通过执行 ESP-IDF 安装脚本 ``--enable-pytest`` 进行安装:
.. code-block:: bash
$ install.sh --enable-pytest
额外的测试脚本依赖项可以通过执行 ESP-IDF 安装脚本 ``--enable-pytest-specific`` 进行安装:
.. code-block:: bash
$ install.sh --enable-test-specific
上面的脚本已预先实现了一些机制,以确保所有安装过程顺利进行。如果您在安装过程中遇到任何问题,请在 `GitHub Issue 版块 <https://github.com/espressif/esp-idf/issues>`__ 上提交问题说明。
常见概念

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import json
import os
import re
@ -13,7 +12,7 @@ from idf_ci_utils import IDF_PATH
JSON_PATH = os.path.join(IDF_PATH, 'tools', 'requirements.json')
SCHEMA_PATH = os.path.join(IDF_PATH, 'tools', 'requirements_schema.json')
REQ_DIR = os.path.join(IDF_PATH, 'tools', 'requirements')
RE_FEATURE = re.compile(r'requirements\.(\w+)\.txt')
RE_FEATURE = re.compile(r'requirements\.([\w-]+)\.txt')
def action_validate(req_obj: Any) -> None: # "Any" because we are checking this in this script

View File

@ -19,6 +19,12 @@
"optional": true,
"requirement_path": "tools/requirements/requirements.pytest.txt"
},
{
"name": "test-specific",
"description": "Packages for specific test scripts",
"optional": true,
"requirement_path": "tools/requirements/requirements.test-specific.txt"
},
{
"name": "ci",
"description": "Packages for ESP-IDF CI scripts",

View File

@ -15,21 +15,3 @@ minio
# build
python-gitlab
idf-build-apps
# dependencies in pytest test scripts
scapy
websocket-client
netifaces
rangehttpserver
dbus-python; sys_platform == 'linux'
protobuf
bleak
paho-mqtt
paramiko
netmiko
# iperf_test_util
pyecharts
# for twai tests, communicate with socket can device (e.g. Canable)
python-can

View File

@ -0,0 +1,20 @@
# Python package requirements for specific test scripts in ESP-IDF.
# This feature can be enabled by running "install.{sh,bat,ps1,fish} --enable-test-specific"
# dependencies in pytest test scripts
scapy
websocket-client
netifaces
rangehttpserver
dbus-python; sys_platform == 'linux'
protobuf
bleak
paho-mqtt
paramiko
netmiko
# iperf_test_util
pyecharts
# for twai tests, communicate with socket can device (e.g. Canable)
python-can