Fix straggler usage of legacy psutil form

Review Request #2546 - Created July 30, 2015 and submitted

Information
Kris Wilson
pants
kwlzn/psutil_fixup
1889
a41eb1e...
Reviewers
pants-reviews
areitz, jsirois, nhoward_tw, stuhood
- Fix straggler usage of legacy psutil property form in pidlock.py.
- Add a simple test case to exercise the psutil dependency to catch this in CI in the future.
https://travis-ci.org/pantsbuild/pants/builds/73467865

with the new test, pre-fix:

[illuminati pants (kwlzn/psutil_fixup)]$ PANTS_DEV=1 ./pants test tests/python/pants_test/process::
...
15:36:02 00:00     [pytest]
15:36:02 00:00       [run]
                     ============== test session starts ===============
                     platform darwin -- Python 2.7.6 -- py-1.4.30 -- pytest-2.6.4
                     plugins: timeout, cov
                     collected 9 items 
                     
                     tests/python/pants_test/process/test_pidlock.py F
                     tests/python/pants_test/process/test_xargs.py ........
                     
                     ==================== FAILURES ====================
                      TestOwnerPrintingPIDLockFile.test_cmdline_for_pid 
                     
                     self = <pants_test.process.test_pidlock.TestOwnerPrintingPIDLockFile testMethod=test_cmdline_for_pid>
                     
                         def test_cmdline_for_pid(self):
                     >     self.assertIsInstance(self.obj.cmdline_for_pid(os.getpid()))
                     
                     tests/python/pants_test/process/test_pidlock.py:19: 
                     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                     
                     pid = 82357
                     
                         @staticmethod
                         def cmdline_for_pid(pid):
                           try:
                             process = psutil.Process(pid)
                     >       return ' '.join(process.cmdline)
                     E       TypeError
                     
                     src/python/pants/process/pidlock.py:38: TypeError
                     ======= 1 failed, 8 passed in 0.05 seconds =======
...
FAILURE


and with the fix:

[illuminati pants (kwlzn/psutil_fixup)]$ PANTS_DEV=1 ./pants test tests/python/pants_test/process::
...
15:38:41 00:00     [pytest]
15:38:41 00:00       [run]
                     ============== test session starts ===============
                     platform darwin -- Python 2.7.6 -- py-1.4.30 -- pytest-2.6.4
                     plugins: timeout, cov
                     collected 9 items 
                     
                     tests/python/pants_test/process/test_pidlock.py .
                     tests/python/pants_test/process/test_xargs.py ........
                     
                     ============ 9 passed in 0.04 seconds ============
...
               SUCCESS
Stu Hood
John Sirois
John Sirois
Kris Wilson
Review request changed

Status: Closed (submitted)

Loading...