diff --git a/conftest.py b/conftest.py index 5270eb2dba..8890d1d3e0 100644 --- a/conftest.py +++ b/conftest.py @@ -206,6 +206,9 @@ def build_dir( check_dirs = [f'build_{target}_{config}'] else: check_dirs = [] + build_dir_arg = request.config.getoption('build_dir', None) + if build_dir_arg: + check_dirs.append(build_dir_arg) if target is not None and config is not None: check_dirs.append(f'build_{target}_{config}') if target is not None: diff --git a/docs/en/contribute/esp-idf-tests-with-pytest.rst b/docs/en/contribute/esp-idf-tests-with-pytest.rst index 28e8485947..e668dc8b8a 100644 --- a/docs/en/contribute/esp-idf-tests-with-pytest.rst +++ b/docs/en/contribute/esp-idf-tests-with-pytest.rst @@ -478,6 +478,7 @@ Build Directories By default, each test case looks for the required binary files in the following directories (in order): +- Directory set by ``--build-dir`` command line argument, if specified. - ``build__`` - ``build_`` - ``build_`` diff --git a/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst b/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst index 62dd086e3b..593bced4ea 100644 --- a/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst +++ b/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst @@ -574,6 +574,7 @@ CI 用于执行所有相关测试的命令为: ``pytest --target 默认情况下,pytest 脚本会按照以下顺序查找编译目录: +- 由 ``--build-dir`` 命令行参数设置的目录。(当指定时) - ``build__`` - ``build_`` - ``build_``