Test failures with Jython

Bug #1019653 reported by Arfrever Frehtes Taifersar Arahesis on 2012-06-30
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

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

>>> os.readlink("/proc/self/exe")
>>> sys.executable

$ PYTHONPATH="." jython2.7 test/auto.py
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 @@
             env['PYTHONPATH'] = oldcwd
- 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()

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:


The proposed change gets me as far as:


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  Edit
Everyone can see this information.

Other bug subscribers