build system: add the initial set of pytest-based build system tests

This commit is contained in:
Ivan Grokhotkov
2022-08-09 02:11:57 +02:00
parent 1146b83bf1
commit 0503cb52eb
17 changed files with 851 additions and 0 deletions

View 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)