[Jython-checkins] jython: Fix test_jython_initializer failure on Windows.

jeff.allen jython-checkins at python.org
Sun Oct 27 23:49:38 CET 2013


http://hg.python.org/jython/rev/5fbd70fec808
changeset:   7144:5fbd70fec808
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Sat Oct 26 14:24:06 2013 +0100
summary:
  Fix test_jython_initializer failure on Windows.
Long-standing annoyance finally diagnosed as due to not passing enough environment
through to the subprocess. Chose to keep it minimal, rather than pass it all.

files:
  Lib/test/test_jython_initializer.py |   9 +++++++++
  src/org/python/core/Py.java         |  10 ++++++----
  2 files changed, 15 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_jython_initializer.py b/Lib/test/test_jython_initializer.py
--- a/Lib/test/test_jython_initializer.py
+++ b/Lib/test/test_jython_initializer.py
@@ -4,12 +4,21 @@
 import unittest
 from test import test_support
 
+WINDOWS = (os._name if test_support.is_jython else os.name) == 'nt'
+
 class TestUsingInitializer(unittest.TestCase):
 
     def test_syspath_initializer(self):
         fn = test_support.findfile('check_for_initializer_in_syspath.py')
         env = dict(CLASSPATH='tests/data/initializer',
                    PATH=os.environ.get('PATH', ''))
+
+        if WINDOWS:
+            # TMP is needed to give property java.io.tmpdir a sensible value
+            env['TMP'] = os.environ.get('TMP', '.')
+            # SystemRoot is needed to remote debug the subprocess JVM
+            env['SystemRoot'] = os.environ.get('SystemRoot', '')
+
         self.assertEquals(0, subprocess.call([sys.executable, fn], env=env))
 
 def test_main():
diff --git a/src/org/python/core/Py.java b/src/org/python/core/Py.java
--- a/src/org/python/core/Py.java
+++ b/src/org/python/core/Py.java
@@ -1450,11 +1450,13 @@
     }
 
     /**
-     * Check (using the {@link POSIX} library) whether we are in an interactive environment. Amongst
-     * other things, this affects the type of console that may be legitimately installed during
-     * system initialisation.
+     * Check (using the {@link POSIX} library and <code>jnr-posix</code> library) whether we are in
+     * an interactive environment. Amongst other things, this affects the type of console that may
+     * be legitimately installed during system initialisation. Note that the result may vary
+     * according to whether a <code>jnr-posix</code> native library is found along
+     * <code>java.library.path</code>, or the pure Java fall-back is used.
      *
-     * @return
+     * @return true if (we think) we are in an interactive environment
      */
     public static boolean isInteractive() {
         // Decide if System.in is interactive

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list