1
私はpytest.iniファイルにカスタムパラメータを提供し、コードからそれを読みたいと思っています。ここ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をスローしていない:
def test_failtest(self, request):
config = request.config
tcv = config.getoption('custom_value')
print "tcv->" + tcv
ドキュメントを読んでチェックする私はそれがカスタム値をサポートしているとは思っていませんconfig https://pytest.org/latest/customize.html – lapinkoira
@ lapinkoiraこれは、iniファイルが 'Builtin設定ファイルオプション '[(link)](https://docs.pytest.org/ja/latest/customize.html#builtin-configuration-file-options)開発者は任意のオプションを生成する手段を残さないでしょうか?条件付きで拡張テストと基本テストを実行するオプションを作成し、自家製の環境変数チェックなどの代わりに組み込みのものを探していました。 – jxramos