kiranvizru / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

test_exe() failure on OS X 10.8.4 #396

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
======================================================================
FAIL: test_exe (__main__.TestProcess)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 1221, in test_exe
    self.assertEqual(exe.replace(ver, ''), PYTHON.replace(ver, ''))
AssertionError: 
'/System/Library/Frameworks/Python.framework/Versions//Resources/Python.app/Cont
ents/MacOS/Python' != '/usr/bin/python'

Looks like this is similar to what we've seen before on OS X where the 
sys.executable() is not necessarily going to match what is invoked at the 
commandline. 

I thought I had put code in a while back to work around this on OS X instead of 
failing the test, but it looks like that was removed at some point from the 
test suite. 

Original issue reported on code.google.com by jlo...@gmail.com on 18 Jun 2013 at 12:42

GoogleCodeExporter commented 9 years ago
I might have done it although I don't remember, sorry.
Being this problem related to tests per-se I'm not going to hold back on 
releasing 1.0.0.

Original comment by g.rodola on 10 Jul 2013 at 2:18

GoogleCodeExporter commented 9 years ago
That's fine, it's obviously not a showstopper bug, it's just a peculiarity of 
the way Python is launched on OS X versus reported by sys.executable() 

I'm not sure how to work around this best for purposes of the test. As you can 
see the two values don't match at all and it doesn't seem to matter which way 
you launch Python either. I believe what I did previously was just do a case 
insensitive compare to the basename of the two values to make sure we get 
"python" for both. 

Original comment by jlo...@gmail.com on 10 Jul 2013 at 2:21

GoogleCodeExporter commented 9 years ago
If the 2 paths are so different than maybe it makes sense to just skip the test 
(I mean that specific line) and in case it's not there already just test 
whether the path exists and/or is a file and/or is executable.

Original comment by g.rodola on 10 Jul 2013 at 2:26

GoogleCodeExporter commented 9 years ago
That sounds reasonable to me, if we check that "exe" is there and executable. 
Here's an example from my system: 

>>> p.exe
'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/C
ontents/MacOS/Python'

[user@host ]$ ls -l 
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Co
ntents/MacOS/Python
-rwxr-xr-x  1 root  wheel  34608 Jun 11 17:30 
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Co
ntents/MacOS/Python

Original comment by jlo...@gmail.com on 10 Jul 2013 at 2:32