[Jython-checkins] jython: Fix minor test failures in test_descrtut, test_float_jy,
jim.baker
jython-checkins at python.org
Sun Sep 7 05:56:58 CEST 2014
http://hg.python.org/jython/rev/7fbbad825be4
changeset: 7369:7fbbad825be4
user: Jim Baker <jim.baker at rackspace.com>
date: Sat Sep 06 21:56:50 2014 -0600
summary:
Fix minor test failures in test_descrtut, test_float_jy,
test_isinstance, test_pbcvm, test_platform, test_pwd, test_select_new,
test_sysconfig, and test_unicodedata, in some cases by better skips.
files:
Lib/platform.py | 1 +
Lib/pwd.py | 3 +++
Lib/test/regrtest.py | 1 +
Lib/test/test_descrtut.py | 1 +
Lib/test/test_float_jy.py | 2 +-
Lib/test/test_pbcvm.py | 5 ++++-
Lib/test/test_platform.py | 3 +++
Lib/test/test_sysconfig.py | 1 +
Lib/test/test_unicodedata.py | 24 +++++++++++++++++-------
9 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/Lib/platform.py b/Lib/platform.py
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -777,6 +777,7 @@
return release,versioninfo,machine
def _mac_ver_xml():
+ return None # Jython patch
fn = '/System/Library/CoreServices/SystemVersion.plist'
if not os.path.exists(fn):
return None
diff --git a/Lib/pwd.py b/Lib/pwd.py
--- a/Lib/pwd.py
+++ b/Lib/pwd.py
@@ -12,6 +12,7 @@
from os import _name, _posix_impl
from org.python.core.Py import newString
+import sys
if _name == 'nt':
raise ImportError, 'pwd module not supported on Windows'
@@ -48,6 +49,8 @@
Return the password database entry for the given numeric user ID.
See pwd.__doc__ for more on password database entries.
"""
+ if uid > sys.maxint or uid < 0:
+ raise KeyError
entry = _posix_impl.getpwuid(uid)
if not entry:
raise KeyError(uid)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1307,6 +1307,7 @@
test_peepholer
test_pyclbr
test_pyexpat
+ test_select_new
test_stringprep
test_threadsignals
test_transformer
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py
--- a/Lib/test/test_descrtut.py
+++ b/Lib/test/test_descrtut.py
@@ -182,6 +182,7 @@
'__delitem__',
'__delslice__',
'__doc__',
+ '__ensure_finalizer__',
'__eq__',
'__format__',
'__ge__',
diff --git a/Lib/test/test_float_jy.py b/Lib/test/test_float_jy.py
--- a/Lib/test/test_float_jy.py
+++ b/Lib/test/test_float_jy.py
@@ -14,7 +14,7 @@
def test_float_repr(self):
self.assertEqual(repr(12345678.000000005), '12345678.000000006')
self.assertEqual(repr(12345678.0000000005), '12345678.0')
- self.assertEqual(repr(math.pi**-100), '1.9275814160560206e-50')
+ self.assertRegexpMatches(repr(math.pi**-100), '1.927581416056020[0-9]e-50')
self.assertEqual(repr(-1.0), '-1.0')
self.assertEqual(repr(-9876.543210), '-9876.54321')
self.assertEqual(repr(0.123456789e+35), '1.23456789e+34')
diff --git a/Lib/test/test_pbcvm.py b/Lib/test/test_pbcvm.py
--- a/Lib/test/test_pbcvm.py
+++ b/Lib/test/test_pbcvm.py
@@ -66,7 +66,10 @@
def test_main():
- test_support.run_unittest(PyBytecodeTest, AdhocRegrtest)
+ test_support.run_unittest(
+ PyBytecodeTest,
+ # AdhocRegrtest # reinstate once we have Python bytecode compilation, too hard to coordinate otherwise
+ )
if __name__ == "__main__":
test_main()
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
@@ -5,12 +5,14 @@
import subprocess
from test import test_support
+from test.test_support import is_jython
class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
if hasattr(os, "symlink"):
+ @unittest.skipIf(is_jython, "Cannot just symlink Jython startup script")
def test_architecture_via_symlink(self): # issue3762
def get(python):
cmd = [python, '-c',
@@ -162,6 +164,7 @@
def test_win32_ver(self):
res = platform.win32_ver()
+ @unittest.skipIf(is_jython, "No uname support in Jython")
def test_mac_ver(self):
res = platform.mac_ver()
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -240,6 +240,7 @@
'java_user'}
self.assertEqual({name for name in get_scheme_names()}, wanted)
+ @unittest.skipIf(is_jython, "Cannot just symlink Jython startup script")
def test_symlink(self):
# Issue 7880
symlink = get_attribute(os, "symlink")
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -17,15 +17,23 @@
### Run tests
+
+def all_codepoints():
+ for i in xrange(sys.maxunicode+1):
+ if i >= 0xD800 and i <= 0xDFFF:
+ continue
+ yield i
+
+
class UnicodeMethodsTest(unittest.TestCase):
# update this, if the database changes
expectedchecksum = '4504dffd035baea02c5b9de82bebc3d65e0e0baf'
- @unittest.skipIf(test.test_support.is_jython, "Jython uses ICU4J")
+ @unittest.skipIf(test.test_support.is_jython, "Jython uses ICU4J, so checksum tests are not meaningful")
def test_method_checksum(self):
h = hashlib.sha1()
- for i in range(0x10000):
+ for i in all_codepoints():
char = unichr(i)
data = [
# Predicates (single char)
@@ -82,7 +90,7 @@
# update this, if the database changes
expectedchecksum = '6ccf1b1a36460d2694f9b0b0f0324942fe70ede6'
- @unittest.skipIf(test.test_support.is_jython, "Jython uses ICU4J")
+ @unittest.skipIf(test.test_support.is_jython, "Jython uses ICU4J, so checksum tests are not meaningful")
def test_function_checksum(self):
data = []
h = hashlib.sha1()
@@ -246,7 +254,7 @@
# i.e. if a character has a decimal value,
# its numeric value should be the same.
count = 0
- for i in xrange(0x10000):
+ for i in all_codepoints():
c = unichr(i)
dec = self.db.decimal(c, -1)
if dec != -1:
@@ -259,7 +267,7 @@
# i.e. if a character has a digit value,
# its numeric value should be the same.
count = 0
- for i in xrange(0x10000):
+ for i in all_codepoints():
c = unichr(i)
dec = self.db.digit(c, -1)
if dec != -1:
@@ -282,12 +290,14 @@
self.assertTrue(u"\u1d79".upper()==u'\ua77d')
self.assertTrue(u".".upper()==u".")
+
+
def test_bug_5828(self):
self.assertEqual(u"\u1d79".lower(), u"\u1d79")
# Only U+0000 should have U+0000 as its upper/lower/titlecase variant
self.assertEqual(
[
- c for c in range(sys.maxunicode+1)
+ c for c in all_codepoints()
if u"\x00" in unichr(c).lower()+unichr(c).upper()+unichr(c).title()
],
[0]
@@ -300,7 +310,7 @@
self.assertEqual(u"\u01c6".title(), u"\u01c5")
def test_linebreak_7643(self):
- for i in range(0x10000):
+ for i in all_codepoints():
lines = (unichr(i) + u'A').splitlines()
if i in (0x0a,
# 0x0b,
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list