Re: [Pydev-code] Some problems running Unit Tests
Brought to you by:
fabioz
From: Mark L. <mid...@ve...> - 2016-01-25 19:03:02
|
> > A failure I don't expect: > > In PythonShellTest at line 95, and IndexOutOfBounds exception is > thrown. > The "list" object is empty, apparently because the import for the > "math" > module fails. I believe I have all the python locations and files > specified properly, and if I launch a python shell manually, I can > successfully import the math module. > > > Well, I don't have that failure here, so, it really seems unexpected, > although it's hard to know why without further details -- it probably > means you have some issue communicating with the shell (so, maybe you > could try debugging it there?) In the debugger I see that it fails to import the math module. If I'm reading the stack trace correctly, the directories on sys.path are ['/opt/git/Pydev/plugins/org.python.pydev/tests/pysrc', '/usr/lib64/python2.6', '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages/OpenGL'] When I launch a python 2.6 shell, I can import math successfully, and 'math.__file__' returns /usr/lib64/python2.6/lib-dynload/mathmodule.so So it seems I need to add "/usr/lib64/python2.6/lib-dynload" to sys.path. I tried doing that by creating a file /usr/lib64/python2.6/site-packages/math.pth (the value of PYTHON_SITE_PACKAGES in TestDepedendent.linux.properties is /usr/lib64/python2.6/site-packages), and adding the path for lib-dynload to that file (tried absolute and relative paths). I also tried setting PYTHONPATH to /usr/lib64/python2.6/lib-dynload:$PYTHONPATH on the Environment tab of the run config for AllTests. It still fails, and the value of sys.path that I see in the stack trace does not include the lib-dynload directory. The dir I pre-pended to PYHTONPATH is not included in the value of the pythonpath parameter passed in to method Tuple() at AbstractShell line 748. Any idea how I can add that dir to sys.path for the tests? Here is my stack trace: (None,(ERROR:,Traceback (most recent call last): File "/opt/git/Pydev/plugins/org.python.pydev/pysrc/pycompletionserver.py", line 294, in run defFile, comps = _pydev_imports_tipper.generate_tip(data, log) File "/opt/git/Pydev/plugins/org.python.pydev/pysrc/_pydev_bundle/_pydev_imports_tipper.py", line 132, in generate_tip f, mod, parent, foundAs = Find(data, log) File "/opt/git/Pydev/plugins/org.python.pydev/pysrc/_pydev_bundle/_pydev_imports_tipper.py", line 82, in Find mod = _imp(name, log) File "/opt/git/Pydev/plugins/org.python.pydev/pysrc/_pydev_bundle/_pydev_imports_tipper.py", line 38, in _imp raise ImportError(s) ImportError: Unable to import module: math - sys.path: ['/opt/git/Pydev/plugins/org.python.pydev/tests/pysrc', '/usr/lib64/python2.6', '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages/OpenGL'] Log:Unable to import module: math - sys.path: ['/opt/git/Pydev/plugins/org.python.pydev/tests/pysrc', '/usr/lib64/python2.6', '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages/OpenGL'] Traceback (most recent call last): File "/opt/git/Pydev/plugins/org.python.pydev/pysrc/_pydev_bundle/_pydev_imports_tipper.py", line 22, in _imp return __import__(name) ImportError: No module named math , )) |