8bb0bb5fbf
[Add] 增加对binding和tests的代码质量检查 [Add] 更新README.md
22 lines
537 B
Python
22 lines
537 B
Python
import logging
|
|
import os
|
|
from typing import Callable
|
|
|
|
logger = logging.getLogger(__file__)
|
|
|
|
|
|
def check_and_warning(*args, fast_fail: bool = False):
|
|
passed = True
|
|
for i in args:
|
|
if isinstance(i, Callable):
|
|
print(f"check using {i}")
|
|
cwd = os.getcwd()
|
|
res = i()
|
|
os.chdir(cwd)
|
|
if not res:
|
|
passed = False
|
|
logger.warning("check of %s failed!", i)
|
|
if not passed and fast_fail:
|
|
return False
|
|
return passed
|