我想在pytest.ini文件中提供自定义参数,并从代码中读取它。
[pytest]
markers =
regression: mark a test as regression.
sanity: mark a test as sanity.
critical: mark a test as critical.
addopts= -sv --html=report.html
custom_value= test
这里我想阅读 custom_value 我在下面尝试了但它没有工作并抛出 ValueError:没有名为' custom_value'
的选项def test_failtest(self, request):
config = request.config
tcv = config.getoption('custom_value')
print "tcv->" + tcv
答案 0 :(得分:2)
您需要使用find('.text-angular div[contenteditable]').set('Upgraded to SSD')
挂钩来宣传该选项:
pytest_addoption