classification
Title: remove Linux skip from test_subprocess's test_executable() test
Type: behavior Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: chris.jerdonek, pitrou, python-dev
Priority: normal Keywords: buildbot, patch

Created on 2012-10-09 01:41 by chris.jerdonek, last changed 2012-10-09 23:43 by chris.jerdonek. This issue is now closed.

Files
File name Uploaded Description Edit
issue-16170-1.patch chris.jerdonek, 2012-10-09 20:01 review
Messages (11)
msg172432 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-09 01:41
This issue is to make whatever changes are necessary to remove the skip from test_subprocess's test_executable() test (currently skipping machines that are neither Windows nor Mac):

http://hg.python.org/cpython/file/ef90c5e482f4/Lib/test/test_subprocess.py#l203

The test currently fails on several Linux buildbots, but the test succeeds on Mac and Windows.  Perhaps this points to a different, underlying issue that needs to be fixed.

Either way, we should be able to test Popen()'s executable argument on Linux machines.  This issue seems closely related to closed issue #7774.

Below is more information from a buildbot about the failure (the AMD64 Ubuntu LTS buildbot):

http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%203.3/builds/38/steps/test/logs/stdio

FAIL: test_executable (test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_subprocess.py", line 205, in test_executable
    self._assert_python(["doesnotexist", "-c"], executable=sys.executable)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_subprocess.py", line 201, in _assert_python
    self.assertEqual(47, p.returncode)
AssertionError: 47 != -6

======================================================================
FAIL: test_executable (test.test_subprocess.ProcessTestCaseNoPoll)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_subprocess.py", line 205, in test_executable
    self._assert_python(["doesnotexist", "-c"], executable=sys.executable)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_subprocess.py", line 201, in _assert_python
    self.assertEqual(47, p.returncode)
AssertionError: 47 != -6

test_executable (test.test_subprocess.ProcessTestCase) ... Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
FAIL
msg172435 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-09 01:48
For future reference, this issue resulted from the tests committed for issue 16115.
msg172468 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-10-09 10:15
Try prefixing "doesnotexist" with the same dirname as sys.executable
(i.e. `os.path.join(os.path.dirname(sys.executable), "doesnotexist")`).

Python under Unix uses its own path to determine where the standard library is, and it does so by inspecting argv[0].
msg172511 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-09 20:01
Thanks for the explanation and suggestion, Antoine.  I'm attaching a patch that incorporates the suggestion, but I haven't checked that it works yet (I would need to use snakebite).
msg172512 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-10-09 20:03
Chris, you can also push a custom repo to a custom builder:
http://docs.python.org/devguide/buildbots.html#custom-builders
msg172513 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-10-09 20:05
Actually, I've just checked that your patch works under Linux.
msg172514 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-09 20:06
That's great, thanks for the pointer, Antoine.  I will try that out later today.
msg172516 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-09 20:07
Okay, even better. :)
msg172518 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-09 20:21
New changeset 9451908da615 by Chris Jerdonek in branch '3.3':
Issue #16170: Remove Linux skip from test_subprocess's test_executable test.
http://hg.python.org/cpython/rev/9451908da615

New changeset 0ee03c9b098f by Chris Jerdonek in branch 'default':
Issue #16170: Merge subprocess test unskip from 3.3.
http://hg.python.org/cpython/rev/0ee03c9b098f
msg172541 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-09 22:33
> Python under Unix uses its own path to determine where the standard library is, and it does so by inspecting argv[0].

Actually, how is the above able to work if sys.argv[0] is set to "-c" when Python is invoked using the "-c" option (as it is in the test).

http://docs.python.org/dev/library/sys.html#sys.argv
msg172543 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-09 23:43
Never mind on the above question.  Those are different argv's.
History
Date User Action Args
2012-10-09 23:43:08chris.jerdoneksetmessages: + msg172543
2012-10-09 22:33:37chris.jerdoneksetmessages: + msg172541
2012-10-09 20:23:42chris.jerdoneksetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2012-10-09 20:21:20python-devsetnosy: + python-dev
messages: + msg172518
2012-10-09 20:07:19chris.jerdoneksetmessages: + msg172516
2012-10-09 20:06:25chris.jerdoneksetmessages: + msg172514
2012-10-09 20:05:35pitrousetmessages: + msg172513
2012-10-09 20:03:11pitrousetmessages: + msg172512
2012-10-09 20:01:51chris.jerdoneksetstage: patch review
2012-10-09 20:01:31chris.jerdoneksetfiles: + issue-16170-1.patch
keywords: + patch
messages: + msg172511
2012-10-09 10:15:44pitrousetnosy: + pitrou
messages: + msg172468
2012-10-09 01:48:49chris.jerdoneksetmessages: + msg172435
2012-10-09 01:41:15chris.jerdonekcreate