Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3.3
Changeset: r71443:c7f33aefe221
Date: 2014-05-01 11:16 +0200
http://bitbucket.org/pypy/pypy/changeset/c7f33aefe221/

Log:    Finish sys.implementation

diff --git a/pypy/module/sys/app.py b/pypy/module/sys/app.py
--- a/pypy/module/sys/app.py
+++ b/pypy/module/sys/app.py
@@ -133,5 +133,7 @@
 
 implementation = SimpleNamespace(
     name='pypy',
+    version=sys.version_info,
+    hexversion=sys.hexversion,
     cache_tag=_imp.get_tag(),
     )
diff --git a/pypy/module/sys/test/test_sysmodule.py 
b/pypy/module/sys/test/test_sysmodule.py
--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -495,6 +495,24 @@
         import sys
         assert sys.implementation.name == 'pypy'
 
+        # This test applies to all implementations equally.
+        levels = {'alpha': 0xA, 'beta': 0xB, 'candidate': 0xC, 'final': 0xF}
+
+        assert sys.implementation.version
+        assert sys.implementation.hexversion
+        assert sys.implementation.cache_tag
+
+        version = sys.implementation.version
+        assert version[:2] == (version.major, version.minor)
+
+        hexversion = (version.major << 24 | version.minor << 16 |
+                      version.micro << 8 | levels[version.releaselevel] << 4 |
+                      version.serial << 0)
+        assert sys.implementation.hexversion == hexversion
+
+        # PEP 421 requires that .name be lower case.
+        assert sys.implementation.name == sys.implementation.name.lower()
+
     def test_settrace(self):
         import sys
         counts = []
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to