[Jython-checkins] jython: Fix #2313 test_jython_initializer fails on Windows.
jeff.allen
jython-checkins at python.org
Sun Apr 30 17:17:21 EDT 2017
https://hg.python.org/jython/rev/0a00982f6ea5
changeset: 8075:0a00982f6ea5
user: James Mudd <james.mudd at gmail.com>
date: Sun Apr 30 20:42:08 2017 +0100
summary:
Fix #2313 test_jython_initializer fails on Windows.
This moves SyspathAppendingInitializer and the service definition for
org.python.core.JythonInitializer into a jar which can be more easily
bundled into the tests. The test is then modified to use the jar instead
of using a class file outside /dist which allows the path to resolve on
Windows.
The jar was built using Java 7 (1.7.0_80).
This also removes the need for a custom compile entry in the build
script.
files:
Lib/test/syspath_initializer.jar | Bin
Lib/test/test_jython_initializer.py | 3 +-
build.xml | 10 -----
tests/data/initializer/META-INF/services/org.python.core.JythonInitializer | 1 -
tests/data/initializer/SyspathAppendingInitializer.java | 18 ----------
5 files changed, 2 insertions(+), 30 deletions(-)
diff --git a/Lib/test/syspath_initializer.jar b/Lib/test/syspath_initializer.jar
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3740410030d29791e983d9b1267ef6901b7c0fe6
GIT binary patch
[stripped]
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
@@ -10,7 +10,8 @@
def test_syspath_initializer(self):
fn = test_support.findfile('check_for_initializer_in_syspath.py')
- env = dict(CLASSPATH='tests/data/initializer',
+ jar = test_support.findfile('syspath_initializer.jar')
+ env = dict(CLASSPATH=jar,
PATH=os.environ.get('PATH', ''))
if WINDOWS:
diff --git a/build.xml b/build.xml
--- a/build.xml
+++ b/build.xml
@@ -496,16 +496,6 @@
<compilerarg line="${javac.Xlint}"/>
<classpath refid="test.classpath" />
</javac>
- <javac srcdir="tests/data/initializer"
- destdir="tests/data/initializer"
- target="${jdk.target.version}"
- source="${jdk.source.version}"
- debug="${debug}"
- deprecation="${deprecation}"
- nowarn="${nowarn}">
- <compilerarg line="${javac.Xlint}"/>
- <classpath refid="test.classpath" />
- </javac>
<copy file="${source.dir}/org/python/modules/ucnhash.dat"
todir="${compile.dir}/org/python/modules"
preservelastmodified="true" />
diff --git a/tests/data/initializer/META-INF/services/org.python.core.JythonInitializer b/tests/data/initializer/META-INF/services/org.python.core.JythonInitializer
deleted file mode 100644
--- a/tests/data/initializer/META-INF/services/org.python.core.JythonInitializer
+++ /dev/null
@@ -1,1 +0,0 @@
-SyspathAppendingInitializer
diff --git a/tests/data/initializer/SyspathAppendingInitializer.java b/tests/data/initializer/SyspathAppendingInitializer.java
deleted file mode 100644
--- a/tests/data/initializer/SyspathAppendingInitializer.java
+++ /dev/null
@@ -1,18 +0,0 @@
-import java.util.Properties;
-import org.python.core.JythonInitializer;
-import org.python.core.Py;
-import org.python.core.PySystemState;
-import org.python.core.adapter.ExtensiblePyObjectAdapter;
-
-public class SyspathAppendingInitializer implements JythonInitializer {
- public void initialize(Properties preProperties,
- Properties postProperties,
- String[] argv,
- ClassLoader classLoader,
- ExtensiblePyObjectAdapter adapter) {
- postProperties.put(PySystemState.PYTHON_CACHEDIR_SKIP, "true");
- PySystemState defaultState =
- PySystemState.doInitialize(preProperties, postProperties, argv, classLoader, adapter);
- defaultState.path.append(Py.newString("/from_SyspathAppendingInitializer_with_love"));
- }
-}
--
Repository URL: https://hg.python.org/jython
More information about the Jython-checkins
mailing list