環境で64Python 3.3.1
ビットでUbuntu 13.04
実行されている64ビットでEclipse 4.3
64ビットを使用Pydev 2.7.6
していvirtualenv
ます。次のディレクトリ構造にプロジェクトがあります。
Dictionary
|
----------------------------
| |
src test
| |
petaapan petaapan
| | | |
__init__.py logging __init__.py logging
| | | |
__init__.py mplogging.py __init__.py test_mplogging.py
テストランナーとして実行しようとするとtest_mplogging.py
、pytest
次の結果が得られます。
pydev debugger: starting
============================= test session starts ==============================
platform linux -- Python 3.3.1 -- pytest-2.3.5
plugins: pep8, cache
collected 0 items / 1 errors
==================================== ERRORS ====================================
______________________ ERROR collecting test_mplogging.py ______________________
File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/test_mplogging.py", line 11
in <module>
> import petaapan.logging.mplogging as ml
E ImportError: No module named 'petaapan.logging.mplogging'
私sys.path
はDictionary/test
先をDictionary/src
行っているので、テストツリーが最初に検索され、それが通常のパッケージでインポートが失敗した理由のようです。
私の次の試みは、名前空間パッケージを使用して同じことを行うことだったので、すべての__init__.py
ファイルを削除して、次の結果を得ました。
pydev debugger: starting
============================= test session starts ==============================
platform linux -- Python 3.3.1 -- pytest-2.3.5
plugins: pep8, cache
collected 0 items / 1 errors
==================================== ERRORS ====================================
______________________ ERROR collecting test_mplogging.py ______________________
File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/test_mplogging.py", line 11
in <module>
> import petaapan.logging.mplogging as ml
File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/<frozen importlib._bootstrap>", line 1564
in _find_and_load
> ???
File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/<frozen importlib._bootstrap>", line 1522
in _find_and_load_unlocked
> ???
File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/<frozen importlib._bootstrap>", line 1476
in _find_module
> ???
File "/home/jonathan/isiiwesuu/lib/python3.3/site-packages/_pytest/assertion/rewrite.py", line 68
in find_module
> fd, fn, desc = imp.find_module(lastname, path)
File "/home/jonathan/isiiwesuu/lib/python3.3/imp.py", line 197
in find_module
> "not {}".format(type(name)))
E RuntimeError: 'list' must be None or a list, not <class 'str'>
=========================== 1 error in 0.49 seconds ============================
test_mplogging.py
関連する部分は次のとおりです。
import logging
from os import getcwd
from multiprocessing import Queue, Process
import petaapan.logging.mplogging as ml
この状況で私が何をする必要があるかを誰かが提案できますか?