[Jython-checkins] jython: Fix test_platform for Jython.
frank.wierzbicki
jython-checkins at python.org
Fri Apr 6 21:22:52 CEST 2012
http://hg.python.org/jython/rev/6125d9c28cba
changeset: 6539:6125d9c28cba
user: Frank Wierzbicki <fwierzbicki at gmail.com>
date: Fri Apr 06 12:22:40 2012 -0700
summary:
Fix test_platform for Jython.
files:
Lib/test/test_platform.py | 18 +++++++++----
src/org/python/core/PySystemState.java | 5 +++
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -49,15 +49,21 @@
res = platform.processor()
def setUp(self):
- self.save_version = sys.version
- self.save_subversion = sys.subversion
- self.save_platform = sys.platform
+ # These are readonly in Jython
+ if not test_support.is_jython:
+ self.save_version = sys.version
+ self.save_subversion = sys.subversion
+ self.save_platform = sys.platform
def tearDown(self):
- sys.version = self.save_version
- sys.subversion = self.save_subversion
- sys.platform = self.save_platform
+ # These are readonly in Jython
+ if not test_support.is_jython:
+ sys.version = self.save_version
+ sys.subversion = self.save_subversion
+ sys.platform = self.save_platform
+ @unittest.skipIf(test_support.is_jython,
+ "sys.version and sys.subversion are readonly in Jython.")
def test_sys_version(self):
# Old test.
for input, output in (
diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java
--- a/src/org/python/core/PySystemState.java
+++ b/src/org/python/core/PySystemState.java
@@ -56,6 +56,11 @@
private static final String VFSZIP_PREFIX = "vfszip:";
public static final PyString version = new PyString(Version.getVersion());
+
+ public static final PyTuple subversion = new PyTuple(new PyString("Jython"),
+ Py.newString(""),
+ Py.newString(""));
+
public static final int hexversion = ((Version.PY_MAJOR_VERSION << 24) |
(Version.PY_MINOR_VERSION << 16) |
(Version.PY_MICRO_VERSION << 8) |
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list