2016-10-23 9 views
0

私はMacを持っており、Python 3ライブラリ(Appleの標準Python 2.7ライブラリではなく)にpy.testをインストールしました。これはPython 3を使用しているためです。PyDev(Python 3、Mac)のpy.testの設定

PyDevでpy.testを実行すると、次のエラーが発生します。これを解決する方法についての説明は?私はかなりの時間この問題について熟考しました。

collected 1 items 
INTERNALERROR> Traceback (most recent call last): 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/main.py", line 96, in wrap_session 
INTERNALERROR>  session.exitstatus = doit(config, session) or 0 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/main.py", line 130, in _main 
INTERNALERROR>  config.hook.pytest_collection(session=session) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ 
INTERNALERROR>  return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec 
INTERNALERROR>  return self._inner_hookexec(hook, methods, kwargs) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> 
INTERNALERROR>  _MultiCall(methods, kwargs, hook.spec_opts).execute() 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute 
INTERNALERROR>  res = hook_impl.function(*args) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/main.py", line 139, in pytest_collection 
INTERNALERROR>  return session.perform_collect() 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/main.py", line 592, in perform_collect 
INTERNALERROR>  config=self.config, items=items) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__ 
INTERNALERROR>  return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec 
INTERNALERROR>  return self._inner_hookexec(hook, methods, kwargs) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda> 
INTERNALERROR>  _MultiCall(methods, kwargs, hook.spec_opts).execute() 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute 
INTERNALERROR>  res = hook_impl.function(*args) 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/mark.py", line 84, in pytest_collection_modifyitems 
INTERNALERROR>  if not matchmark(colitem, matchexpr): 
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_pytest/mark.py", line 124, in matchmark 
INTERNALERROR>  return eval(markexpr, {}, MarkMapping(colitem.keywords)) 
INTERNALERROR> File "<string>", line 1 
INTERNALERROR>  axfail=2 
INTERNALERROR>   ^
INTERNALERROR> SyntaxError: invalid syntax 

ここで絵です:

Image

注:私はLiClipseにバンドルPyDevはをインストールしました。私はその後、py.testのマニュアルに従って、簡単なpy.testテストファイルを実行した

--maxfail=2 --tb=native 

def func(x): 
    return x + 1 

def test_answer(): 
    assert func(3) == 5 

答えて

0

がpytest構成はそう私はマニュアルに従ってpy.testテストランナーを構成しました正しい。

ので、チェックするためのいくつかのもの:

  1. あなたがpy.test filenameと(LiClipseのうち)コマンドラインでそれを実行することはできますか?

  2. どのようにテストを正確に実行していますか? (Ctrlキー+ F9そのファイルまたはフォルダを実行している?)エラーがpytest(すなわち:pytest.mark.xxx)にマークを評価するときのようです

、それはあなたには、いくつかの無効なマークを持っている可能性がありますあなたのプロジェクトの他の部分では?

+0

コマンドラインで正しく動作します。私はControl + F9(MacではCommand + F9)を実行しています。 – Hadoren

+0

プロジェクトでマークを検索して、マークが問題になるかどうか確認しましたか?また、次のようにしてモジュールを作成します: 'import sys; print(sys.executable); print( '\ n'.join(sorted(sys.path))')、コマンドラインとIDEから実行しますそれが一致するかどうかを確認します。 –

+0

私はコマンドラインとIDEから実行すると、ほとんど一致します。 '/ Users/UserName/Computer Programming/Python Liclipse Workspace/Practice/src' isと '/usr/local/lib/python3.5/site-packages'はIDEでは2行あり、コマンドラインではありません。 – Hadoren

関連する問題