2016-07-04 9 views
0

私はUbuntuでこれを試しています。 PyChestからPyTestを実行すると完全に機能しましたが、同じコマンドを実行しようとすると別のエラーが発生します。 確かに私はコマンドを正しく作っていません。だからここPyChestからPytestを実行できますが、コマンドラインでは実行できません

はそれが私は私もそうで、この

py.test --server ### -s --browser firefox --html=report.html /<some_path>/test_XXX.py 
usage: py.test [options] [file_or_dir] [file_or_dir] [...] 
py.test: error: unrecognized arguments: --server --browser firefox 

を試してみました

lab-automation:~/My_Folder$ py.test /<some_path>/test_XXX.py --server ### -s --browser firefox --html=report.html 
Traceback (most recent call last): 
    File "/usr/local/bin/py.test", line 11, in <module> 
    sys.exit(main()) 
    File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 48, in main 
    config.pluginmanager.check_pending() 
    File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 490, in check_pending 
    (name, hookimpl.plugin)) 
_pytest.vendored_packages.pluggy.PluginValidationError: unknown hook 'pytest_html' in plugin <module 'pytest_suites.conftest' from '/<some_path>/conftest.pyc'> 

シェルにしようとしているされているものを以下PyCharmで

target = /some_path/test_xxx.py  
options= --server ### -s --browser firefox --html=report.html 

そして、次のようになりますこの場合は私のconftestファイルを読むことができないように見える

+0

私はそれを解決できました。私は 'pytest-html'プラグインを使っていました。だから私はそれを使う必要があったときに、私は 'pytest_html'をインポートしていました。 これを行う正しい方法は、 です。pytest_html = item.config.pluginmanager.getplugin( 'html') ' PyCharmを使用していた理由はまだ説明されていませんが、 PyCharmはPyTestとは違っています。 –

答えて

1

はい私はPyTestにはサーバー引数がないと思います。 は、おそらくいくつかのプラグインに

を逃すそれ `sあなたは

py.test --help 

を入力して、引数のリストを見ることができますが、使用できるプラグインのリストhttps://pytest.org/dev/plugins_index/index.htmlをそれをチェックアウト。

+0

--serverスクリプトへのサーバーコマンドライン引数 –

関連する問題