mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 20:21:04 +00:00
build system: add the initial set of pytest-based build system tests
This commit is contained in:
17
tools/test_build_system/test_build_system_helpers/editing.py
Normal file
17
tools/test_build_system/test_build_system_helpers/editing.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import typing
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def append_to_file(filename: typing.Union[str, Path], what: str) -> None:
|
||||
with open(filename, 'a', encoding='utf-8') as f:
|
||||
f.write(what)
|
||||
|
||||
|
||||
def replace_in_file(filename: typing.Union[str, Path], search: str, replace: str) -> None:
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
data = f.read()
|
||||
result = data.replace(search, replace)
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
f.write(result)
|
Reference in New Issue
Block a user