Test failures with Jython
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(
u'/usr/
>>> sys.executable
'/usr/bin/
$ PYTHONPATH="." jython2.7 test/auto.py
FEFEFEFEFEFEFEF
=======
ERROR: test_apport_hook (__main__.T)
Apport hooks
-------
Traceback (most recent call last):
File "test/auto.py", line 37, in tearDown
self.
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.
def setUp(self):
@@ -835,7 +835,7 @@
else:
- s = subprocess.
+ s = subprocess.
(out, err) = s.communicate()
out = out.decode()
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:
EEEEEEEEEEEEEEE EEEEEEEEEEEEEEE EEEEEEEEFEEEEEE EEEEEEE
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.