From 087d055090b5d3b14660c01eba602df287e81a2d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 30 Apr 2024 17:57:17 +0200 Subject: [PATCH] fix(pytest): respect --build-dir argument from pytest-embedded --- conftest.py | 3 +++ docs/en/contribute/esp-idf-tests-with-pytest.rst | 1 + docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst | 1 + 3 files changed, 5 insertions(+) diff --git a/conftest.py b/conftest.py index 79e5ad464a..faae1cbd31 100644 --- a/conftest.py +++ b/conftest.py @@ -212,6 +212,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_``