How to access plugin options within a test? (Python Nose)

后端 未结 2 673
太阳男子
太阳男子 2021-01-06 21:05

We are trying to implement an automated testing framework using nose. The intent is to add a few command line options to pass into the tests, for example a hostname. We run

2条回答
  •  离开以前
    2021-01-06 21:17

    One shortcut is to access import sys; sys.argv within the test - it will have the list of parameters passed to the nose executable, including the plugin ones. Alternatively your plugin can add attributes to your tests, and you can refer to those attributes - but it requires more heavy lifting - similar to this answer.

提交回复
热议问题