Test failures with Jython

Bug #1019653 reported by Arfrever Frehtes Taifersar Arahesis
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-distutils-extra
New
Undecided
Unassigned

Bug Description

All tests fail with Jython due to usage of /proc/self/exe, which references Java executable:

>>> os.readlink("/proc/self/exe")
u'/usr/lib64/icedtea7/bin/java'
>>> sys.executable
'/usr/bin/jython2.7'

$ PYTHONPATH="." jython2.7 test/auto.py
FEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFEFE
======================================================================
ERROR: test_apport_hook (__main__.T)
Apport hooks
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/auto.py", line 37, in tearDown
    self.assertEqual(s, 0, o+e)
AssertionError: Error: Could not find or load main class setup.py

======================================================================
...
Ran 25 tests in 13,706s

FAILED (failures=25, errors=25)
$

/usr/bin/jython2.7 is a shell script, which calls Java executable with appropriate arguments.

I suggest to use sys.executable in test/auto.py:

--- test/auto.py
+++ test/auto.py
@@ -2,7 +2,7 @@

 # test DistUtilsExtra.auto

-import unittest, shutil, tempfile, os, os.path, subprocess, re
+import unittest, shutil, tempfile, os, os.path, subprocess, re, sys

 class T(unittest.TestCase):
     def setUp(self):
@@ -835,7 +835,7 @@
         else:
             env['PYTHONPATH'] = oldcwd
         os.chdir(self.src)
- s = subprocess.Popen(['/proc/self/exe', 'setup.py'] + args, env=env,
+ s = subprocess.Popen([sys.executable, 'setup.py'] + args, env=env,
             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         (out, err) = s.communicate()
         out = out.decode()

Revision history for this message
Daniel Macks (dmacks-netspace) wrote :

The use of procfs also makes the tests non-portable to various non-*nix platforms. For example, darwin doesn't have procfs at all, so p-d-e-2.38 self-tests explode with an initial output line of:

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFEEEEEEEEEEEEE

The proposed change gets me as far as:

...................F......

and that failure is due to a missing dependent package, which means "the fix here" works perfectly.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.