Commit 8256242b authored by Georg Brandl's avatar Georg Brandl

Adapt platform and test_platform to the build identification changes.

parent 1ca2e796
...@@ -1373,7 +1373,9 @@ def _sys_version(sys_version=None): ...@@ -1373,7 +1373,9 @@ def _sys_version(sys_version=None):
name = 'CPython' name = 'CPython'
builddate = builddate + ' ' + buildtime builddate = builddate + ' ' + buildtime
if hasattr(sys, 'subversion'): if hasattr(sys, '_mercurial'):
_, branch, revision = sys._mercurial
elif hasattr(sys, 'subversion'):
# sys.subversion was added in Python 2.5 # sys.subversion was added in Python 2.5
_, branch, revision = sys.subversion _, branch, revision = sys.subversion
else: else:
......
...@@ -51,11 +51,13 @@ class PlatformTest(unittest.TestCase): ...@@ -51,11 +51,13 @@ class PlatformTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.save_version = sys.version self.save_version = sys.version
self.save_subversion = sys.subversion self.save_subversion = sys.subversion
self.save_mercurial = sys._mercurial
self.save_platform = sys.platform self.save_platform = sys.platform
def tearDown(self): def tearDown(self):
sys.version = self.save_version sys.version = self.save_version
sys.subversion = self.save_subversion sys.subversion = self.save_subversion
sys._mercurial = self.save_mercurial
sys.platform = self.save_platform sys.platform = self.save_platform
def test_sys_version(self): def test_sys_version(self):
...@@ -103,10 +105,12 @@ class PlatformTest(unittest.TestCase): ...@@ -103,10 +105,12 @@ class PlatformTest(unittest.TestCase):
sys_versions.items(): sys_versions.items():
sys.version = version_tag sys.version = version_tag
if subversion is None: if subversion is None:
if hasattr(sys, "_mercurial"):
del sys._mercurial
if hasattr(sys, "subversion"): if hasattr(sys, "subversion"):
del sys.subversion del sys.subversion
else: else:
sys.subversion = subversion sys._mercurial = subversion
if sys_platform is not None: if sys_platform is not None:
sys.platform = sys_platform sys.platform = sys_platform
self.assertEqual(platform.python_implementation(), info[0]) self.assertEqual(platform.python_implementation(), info[0])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment