Pytest运行一个启动脚本

时间:2018-04-06 05:11:09

标签: pytest

在pytest实际收集并执行我的模块之前,我需要从另一个模块运行外部启动脚本来进行一些修补,我想编辑pytest源代码。我应该编辑pytest源代码中的哪一个来实现这一点?我的意思是我的启动脚本必须在所有其他活动之前默认运行。 任何指针都将受到赞赏。

3 个答案:

答案 0 :(得分:0)

您可以从启动脚本调用pytest - 请参阅pytest Documentation

class 'App\Imagine\Gd\Imagine' not found

如果您不想使用启动脚本,可以通过编写pytest插件来实现它 - 请参阅pytest Plugin Documentation

答案 1 :(得分:0)

可以完成@ _pytest / main.py,参考函数 - pytest_runtestloop

答案 2 :(得分:0)

conftest.py添加到您的项目主文件夹中,并且您的启动位于pytest_configure()

def pytest_configure(config):
    pass # your startup code here
相关问题