Pytest: How to create standalone py.test script with plugins [closed]

StackOverflow https://stackoverflow.com/questions/21525320

  •  06-10-2022
  •  | 
  •  

質問

I have a jira-pytest pluging. I want to generate runtests.py script containing that plugin. How it can be done?

役に立ちましたか?

解決

Unfortunately the generate function does not currently bundle plugins as far as I know. One could work around this by vendoring the plugin (or as it sounds like in this case the plugin is already shipped) and then enabling it in a conftest.py using the pytest_plugins variable. If the plugin is on the PYTHONPATH (which it will be if it is in the same directory as the module/package being tested) then py.test will import and enable it. See http://pytest.org/latest/plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file in the documentation for details of this.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top