test: improve test_dependency_lock test case

This commit is contained in:
Fu Hanxi
2024-02-21 11:45:17 +01:00
parent 67608c662d
commit a805000945

View File

@ -3,22 +3,17 @@
import os.path import os.path
from pathlib import Path from pathlib import Path
import pytest
from test_build_system_helpers import IdfPyFunc from test_build_system_helpers import IdfPyFunc
@pytest.mark.test_app_copy('examples/get-started/blink')
def test_dependency_lock(idf_py: IdfPyFunc, test_app_copy: Path) -> None: def test_dependency_lock(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
with open(test_app_copy / 'CMakeLists.txt', 'r+') as fw: replace_in_file(
data = fw.read() test_app_copy / 'CMakeLists.txt',
fw.seek(0) search='# placeholder_after_include_project_cmake',
fw.write( replace='idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})',
data.replace( )
'project(blink)',
'idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})\nproject(blink)',
)
)
idf_py('add-dependency', 'example/cmp')
idf_py('fullclean') idf_py('fullclean')
idf_py('reconfigure') idf_py('reconfigure')
assert os.path.isfile(test_app_copy / 'dependencies.lock.esp32') assert os.path.isfile(test_app_copy / 'dependencies.lock.esp32')