mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
Merge branch 'fix/test_project_components_overrides_extra_components' into 'master'
fix: test_managed_components_overrides_idf_components Closes IDFCI-10153 See merge request espressif/esp-idf!47182
This commit is contained in:
@@ -349,6 +349,24 @@ def pytest_report_header(config: Config) -> str:
|
||||
return 'Testing ESP-IDF CMake-based build system v1'
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def clean_root_managed_components(tmp_path: Path) -> typing.Generator[None, None, None]:
|
||||
"""
|
||||
Temporarily clear root managed components and restore them after the test.
|
||||
"""
|
||||
from idf_component_tools.config import root_managed_components_dir
|
||||
|
||||
root_managed = str(root_managed_components_dir())
|
||||
backup = tmp_path / 'root_managed_backup'
|
||||
if os.path.isdir(root_managed):
|
||||
shutil.copytree(root_managed, backup)
|
||||
shutil.rmtree(root_managed)
|
||||
yield
|
||||
shutil.rmtree(root_managed, ignore_errors=True)
|
||||
if backup.is_dir():
|
||||
shutil.copytree(str(backup), root_managed)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def revert_later(request: FixtureRequest) -> typing.Generator[None, None, None]:
|
||||
origin_content_d: dict[str, str] = {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import json
|
||||
import os.path
|
||||
@@ -208,6 +208,10 @@ class TestOptionalDependencyWithKconfig:
|
||||
@pytest.mark.buildv2_skip('Root components (idf_extra_components.yml) not yet supported in cmakev2')
|
||||
@pytest.mark.revert_later(['tools/idf_extra_components.yml'])
|
||||
class TestIdfRootDependency:
|
||||
@pytest.fixture(autouse=True)
|
||||
def _clean_root_managed(self, clean_root_managed_components: None) -> None:
|
||||
pass
|
||||
|
||||
def test_basic_build(self, idf_py: IdfPyFunc, test_app_copy: Path) -> None:
|
||||
with open(os.path.join(EXT_IDF_PATH, 'tools', 'idf_extra_components.yml'), 'w') as fw:
|
||||
fw.write(
|
||||
|
||||
@@ -246,7 +246,9 @@ def test_extra_components_overrides_managed_components(idf_py: IdfPyFunc, test_a
|
||||
|
||||
|
||||
@pytest.mark.with_idf_components(['cmp'])
|
||||
def test_managed_components_overrides_idf_components(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
|
||||
def test_managed_components_overrides_idf_components(
|
||||
idf_py: IdfPyFunc, test_app_copy: Path, clean_root_managed_components: None
|
||||
) -> None:
|
||||
logging.info('Managed components override components defined in IDF_PATH/components')
|
||||
# created idf component 'cmp' in marker
|
||||
idf_path = Path(os.environ['IDF_PATH'])
|
||||
|
||||
Reference in New Issue
Block a user