| 1 |
class AppTestVersion: |
| 2 |
def test_compiler(self): |
| 3 |
import sys |
| 4 |
assert ("MSC v." in sys.version or |
| 5 |
"GCC " in sys.version or |
| 6 |
"(untranslated)" in sys.version) |
| 7 |
|
| 8 |
def test_version_info(self): |
| 9 |
import sys |
| 10 |
assert str(sys.version_info).startswith('sys.version_info') |
| 11 |
|
| 12 |
def test_pypy_version_info(self): |
| 13 |
import sys |
| 14 |
assert str(sys.pypy_version_info).startswith('sys.pypy_version_info') |
| 15 |
|
| 16 |
def test_sys_implementation(self): |
| 17 |
import sys |
| 18 |
assert 'pypy_version_info' in str(sys.implementation) |
| 19 |
|
| 20 |
def test_implementation(self): |
| 21 |
import sys |
| 22 |
levels = {'alpha': 0xA, 'beta': 0xB, 'candidate': 0xC, 'final': 0xF} |
| 23 |
|
| 24 |
assert hasattr(sys.implementation, 'name') |
| 25 |
assert hasattr(sys.implementation, 'version') |
| 26 |
assert hasattr(sys.implementation, 'hexversion') |
| 27 |
assert hasattr(sys.implementation, 'cache_tag') |
| 28 |
|
| 29 |
version = sys.implementation.version |
| 30 |
assert version[:2] == (version.major, version.minor) |
| 31 |
|
| 32 |
hexversion = (version.major << 24 | version.minor << 16 | |
| 33 |
version.micro << 8 | levels[version.releaselevel] << 4 | |
| 34 |
version.serial << 0) |
| 35 |
assert sys.implementation.hexversion == hexversion |
| 36 |
|
| 37 |
|
| 38 |
pypy = sys.implementation.name.lower() |
| 39 |
assert sys.implementation.name == pypy |
| 40 |
|
| 41 |
def test_git_version(self): |
| 42 |
import sys |
| 43 |
info = sys._git |
| 44 |
assert info[0] == "PyPy" |
| 45 |
|
| 46 |
|
| 47 |
def test_get_version(): |
| 48 |
from pypy.module.sys import version |
| 49 |
res = version._make_version_template(PYPY_VERSION=(2,5,0, "final", 1)) |
| 50 |
assert "[PyPy 2.5.0" in res |
| 51 |
res = version._make_version_template(PYPY_VERSION=(2,6,3, "alpha", 5)) |
| 52 |
assert "[PyPy 2.6.3-alpha5" in res |
| 53 |
assert res.endswith(' with %s]') |