Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有什么方法可以从 python 内部而不是通过命令行运行 python 行为?
默认用法:在具有功能/步骤的基本文件夹中运行行为命令
期望的用法:调用在指定文件夹中执行行为测试的函数(或具有一定的导入)
通过处理行为源代码找到了解决方案:
from behave.__main__ import main as behave_main behave_main("path/to/specified/folder")
行为的主要方法枚举并处理它在其参数中找到的所有路径。