Merged revisions 70594-70595 via svnmerge from
svn+pythonssh://pythondev@svn.python.org/python/trunk ........ r70594 | marc-andre.lemburg | 2009-03-25 20:44:58 +0100 (Wed, 25 Mar 2009) | 9 lines Remove the sys.version_info shortcut, since they cause the APIs to return different information than the _sys_version() output used in previous Python versions. This also fixes issue5561: platform.python_version_tuple returns tuple of ints, should be strings Added more tests for the various platform functions. ........ r70595 | marc-andre.lemburg | 2009-03-25 20:45:33 +0100 (Wed, 25 Mar 2009) | 3 lines News item for the platform.py fix (r70594). ........
This commit is contained in:
parent
f70097684e
commit
152f222775
|
@ -1416,8 +1416,6 @@ def python_version():
|
||||||
will always include the patchlevel (it defaults to 0).
|
will always include the patchlevel (it defaults to 0).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if hasattr(sys, 'version_info'):
|
|
||||||
return '%i.%i.%i' % sys.version_info[:3]
|
|
||||||
return _sys_version()[1]
|
return _sys_version()[1]
|
||||||
|
|
||||||
def python_version_tuple():
|
def python_version_tuple():
|
||||||
|
@ -1429,8 +1427,6 @@ def python_version_tuple():
|
||||||
will always include the patchlevel (it defaults to 0).
|
will always include the patchlevel (it defaults to 0).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if hasattr(sys, 'version_info'):
|
|
||||||
return sys.version_info[:3]
|
|
||||||
return tuple(string.split(_sys_version()[1], '.'))
|
return tuple(string.split(_sys_version()[1], '.'))
|
||||||
|
|
||||||
def python_branch():
|
def python_branch():
|
||||||
|
|
|
@ -25,40 +25,49 @@ class PlatformTest(unittest.TestCase):
|
||||||
finally:
|
finally:
|
||||||
os.remove(link)
|
os.remove(link)
|
||||||
|
|
||||||
def test_machine(self):
|
|
||||||
res = platform.machine()
|
|
||||||
|
|
||||||
def test_node(self):
|
|
||||||
res = platform.node()
|
|
||||||
|
|
||||||
def test_platform(self):
|
def test_platform(self):
|
||||||
for aliased in (False, True):
|
for aliased in (False, True):
|
||||||
for terse in (False, True):
|
for terse in (False, True):
|
||||||
res = platform.platform(aliased, terse)
|
res = platform.platform(aliased, terse)
|
||||||
|
|
||||||
|
def test_system(self):
|
||||||
|
res = platform.system()
|
||||||
|
|
||||||
|
def test_node(self):
|
||||||
|
res = platform.node()
|
||||||
|
|
||||||
|
def test_release(self):
|
||||||
|
res = platform.release()
|
||||||
|
|
||||||
|
def test_version(self):
|
||||||
|
res = platform.version()
|
||||||
|
|
||||||
|
def test_machine(self):
|
||||||
|
res = platform.machine()
|
||||||
|
|
||||||
def test_processor(self):
|
def test_processor(self):
|
||||||
res = platform.processor()
|
res = platform.processor()
|
||||||
|
|
||||||
|
def test_python_implementation(self):
|
||||||
|
res = platform.python_implementation()
|
||||||
|
|
||||||
|
def test_python_version(self):
|
||||||
|
res1 = platform.python_version()
|
||||||
|
res2 = platform.python_version_tuple()
|
||||||
|
self.assertEqual(res1, ".".join(res2))
|
||||||
|
|
||||||
|
def test_python_branch(self):
|
||||||
|
res = platform.python_branch()
|
||||||
|
|
||||||
|
def test_python_revision(self):
|
||||||
|
res = platform.python_revision()
|
||||||
|
|
||||||
def test_python_build(self):
|
def test_python_build(self):
|
||||||
res = platform.python_build()
|
res = platform.python_build()
|
||||||
|
|
||||||
def test_python_compiler(self):
|
def test_python_compiler(self):
|
||||||
res = platform.python_compiler()
|
res = platform.python_compiler()
|
||||||
|
|
||||||
def test_version(self):
|
|
||||||
res1 = platform.version()
|
|
||||||
res2 = platform.version_tuple()
|
|
||||||
self.assertEqual(res1, ".".join(res2))
|
|
||||||
|
|
||||||
def test_release(self):
|
|
||||||
res = platform.release()
|
|
||||||
|
|
||||||
def test_system(self):
|
|
||||||
res = platform.system()
|
|
||||||
|
|
||||||
def test_version(self):
|
|
||||||
res = platform.version()
|
|
||||||
|
|
||||||
def test_system_alias(self):
|
def test_system_alias(self):
|
||||||
res = platform.system_alias(
|
res = platform.system_alias(
|
||||||
platform.system(),
|
platform.system(),
|
||||||
|
|
|
@ -92,6 +92,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #5561: Removed the sys.version_info shortcuts from platform's
|
||||||
|
python_version() and python_version_tuple() since they produced different
|
||||||
|
output compared to previous Python versions.
|
||||||
|
|
||||||
- Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop
|
- Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop
|
||||||
forever on incomplete input. That caused tarfile.open() to hang when used
|
forever on incomplete input. That caused tarfile.open() to hang when used
|
||||||
with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or
|
with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or
|
||||||
|
|
Loading…
Reference in New Issue