简体   繁体   English

pytest插件是否适用于python2.6

[英]Does pytest plugins work with python2.6

I am new to pytest and I have python2.6 installed on my setup. 我是pytest的新手,我在我的设置上安装了python2.6。 I installed pytest and the testcases get executed properly. 我安装了pytest并且测试用例得到了正确执行。 I installed couple of plugins like pytest-timeout, putest-xdist etc but these plugins does not load when I run the cases. 我安装了几个插件,如pytest-timeout,putest-xdist等,但是当我运行这些情况时,这些插件不会加载。 For timeout, I get following error: 对于超时,我收到以下错误:
py.test: error: unrecognized arguments: --timeout
Same steps followed with python2.7 works. python2.7后面的步骤相同。 Any idea how this can be solved or alteast steps to debug to know what exactly is causing the issue. 知道如何解决这个问题或改变调试步骤以了解导致问题的确切原因。

Unfortunately pytest < 3.0 "hides" the ImportError happening when failing to import a plugin. 不幸的是,pytest <3.0“隐藏”导致插件失败时发生的ImportError If you remove all plugin arguments but add -rw , you should be able to see what exactly is going wrong in the warning summary. 如果删除所有插件参数但添加-rw ,您应该能够看到警告摘要中出现了什么问题。

In your conftest.py file just add the following line after the imports: 在conftest.py文件中,只需在导入后添加以下行:

pytest_plugins = 'pytest_timeout'

It should solve your issue. 它应该解决你的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM