sys.pypy_version_info

Here are the examples of the python api sys.pypy_version_info taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

23 Examples 7

Example 1

Project: pytest-benchmark
Source File: plugin.py
View license
def pytest_benchmark_generate_machine_info():
    python_implementation = platform.python_implementation()
    python_implementation_version = platform.python_version()
    if python_implementation == 'PyPy':
        python_implementation_version = '%d.%d.%d' % sys.pypy_version_info[:3]
        if sys.pypy_version_info.releaselevel != 'final':
            python_implementation_version += '-%s%d' % sys.pypy_version_info[3:]
    return {
        "node": platform.node(),
        "processor": platform.processor(),
        "machine": platform.machine(),
        "python_compiler": platform.python_compiler(),
        "python_implementation": python_implementation,
        "python_implementation_version": python_implementation_version,
        "python_version": platform.python_version(),
        "python_build": platform.python_build(),
        "release": platform.release(),
        "system": platform.system()
    }

Example 2

Project: vmprof-python
Source File: __init__.py
View license
    def enable(fileno, period=DEFAULT_PERIOD, memory=False, lines=False, warn=True):
        if not isinstance(period, float):
            raise ValueError("You need to pass a float as an argument")
        if warn and sys.pypy_version_info[:3] < (4, 1, 0):
            raise Exception("PyPy <4.1 have various kinds of bugs, pass warn=False if you know what you're doing")
        if warn and memory:
            print("Memory profiling is currently unsupported for PyPy. Running without memory statistics.")
        if warn and lines:
            print('Line profiling is currently unsupported for PyPy. Running without lines statistics.\n')
        gz_fileno = _gzip_start(fileno)
        _vmprof.enable(gz_fileno, period)

Example 3

Project: make.mozilla.org
Source File: utils.py
View license
@contextmanager
def pypy_version(value=None):
    has_prev = hasattr(sys, "pypy_version_info")
    prev = getattr(sys, "pypy_version_info", None)
    if value:
        sys.pypy_version_info = value
    else:
        try:
            delattr(sys, "pypy_version_info")
        except AttributeError:
            pass
    yield
    if prev is not None:
        sys.pypy_version_info = prev
    if not has_prev:
        try:
            delattr(sys, "pypy_version_info")
        except AttributeError:
            pass

Example 4

Project: make.mozilla.org
Source File: utils.py
View license
@contextmanager
def pypy_version(value=None):
    has_prev = hasattr(sys, "pypy_version_info")
    prev = getattr(sys, "pypy_version_info", None)
    if value:
        sys.pypy_version_info = value
    else:
        try:
            delattr(sys, "pypy_version_info")
        except AttributeError:
            pass
    yield
    if prev is not None:
        sys.pypy_version_info = prev
    if not has_prev:
        try:
            delattr(sys, "pypy_version_info")
        except AttributeError:
            pass

Example 5

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = b"abc"
        rbuf = bytearray(3)
        Sendrecv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 6

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = bytearray(b"abc")
        rbuf = bytearray(3)
        Sendrecv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 7

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = b"abc"
        rbuf = bytearray(3)
        Alltoallv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 8

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = bytearray(b"abc")
        rbuf = bytearray(3)
        Alltoallv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 9

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = b"abc"
        rbuf = bytearray(3)
        smsg = [sbuf, [3], [0], [MPI.CHAR]]
        rmsg = [rbuf, ([3], [0]), [MPI.CHAR]]
        Alltoallw(smsg, rmsg)
        self.assertEqual(sbuf, rbuf)

Example 10

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = bytearray(b"abc")
        rbuf = bytearray(3)
        smsg = [sbuf, [3], [0], [MPI.CHAR]]
        rmsg = [rbuf, ([3], [0]), [MPI.CHAR]]
        Alltoallw(smsg, rmsg)
        self.assertEqual(sbuf, rbuf)

Example 11

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        for target in (None, 0, [0, 3, MPI.BYTE]):
            sbuf = b"abc"
            rbuf = bytearray(3)
            PutGet(sbuf, rbuf, target)
            self.assertEqual(sbuf, rbuf)

Example 12

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        for target in (None, 0, [0, 3, MPI.BYTE]):
            sbuf = bytearray(b"abc")
            rbuf = bytearray(3)
            PutGet(sbuf, rbuf, target)
            self.assertEqual(sbuf, rbuf)

Example 13

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = b"abc"
        rbuf = bytearray(3)
        Sendrecv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 14

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = bytearray(b"abc")
        rbuf = bytearray(3)
        Sendrecv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 15

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = b"abc"
        rbuf = bytearray(3)
        Alltoallv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 16

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = bytearray(b"abc")
        rbuf = bytearray(3)
        Alltoallv([sbuf, "c"], [rbuf, MPI.CHAR])
        self.assertEqual(sbuf, rbuf)

Example 17

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = b"abc"
        rbuf = bytearray(3)
        smsg = [sbuf, [3], [0], [MPI.CHAR]]
        rmsg = [rbuf, ([3], [0]), [MPI.CHAR]]
        Alltoallw(smsg, rmsg)
        self.assertEqual(sbuf, rbuf)

Example 18

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        sbuf = bytearray(b"abc")
        rbuf = bytearray(3)
        smsg = [sbuf, [3], [0], [MPI.CHAR]]
        rmsg = [rbuf, ([3], [0]), [MPI.CHAR]]
        Alltoallw(smsg, rmsg)
        self.assertEqual(sbuf, rbuf)

Example 19

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytes(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        for target in (None, 0, [0, 3, MPI.BYTE]):
            sbuf = b"abc"
            rbuf = bytearray(3)
            PutGet(sbuf, rbuf, target)
            self.assertEqual(sbuf, rbuf)

Example 20

Project: mpi4py
Source File: test_msgspec.py
View license
    def testMessageBytearray(self):
        if hasattr(sys, 'pypy_version_info'):
            if sys.pypy_version_info < (5, 3): return
        for target in (None, 0, [0, 3, MPI.BYTE]):
            sbuf = bytearray(b"abc")
            rbuf = bytearray(3)
            PutGet(sbuf, rbuf, target)
            self.assertEqual(sbuf, rbuf)

Example 21

Project: opbeat_python
Source File: base.py
View license
    def get_platform_info(self):
        platform_bits = {'lang': 'python/' + platform.python_version()}
        implementation = platform.python_implementation()
        if implementation == 'PyPy':
            implementation += '/' + '.'.join(map(str, sys.pypy_version_info[:3]))
        platform_bits['platform'] = implementation
        if self._framework_version:
            platform_bits['framework'] = self._framework_version
        return ' '.join('%s=%s' % item for item in platform_bits.items())

Example 22

Project: pytest
Source File: test_capture.py
View license
@pytest.mark.parametrize("method", ['fd', 'sys'])
def test_capturing_unicode(testdir, method):
    if hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (2,2):
        pytest.xfail("does not work on pypy < 2.2")
    if sys.version_info >= (3, 0):
        obj = "'b\u00f6y'"
    else:
        obj = "u'\u00f6y'"
    testdir.makepyfile("""
        # coding=utf8
        # taken from issue 227 from nosetests
        def test_unicode():
            import sys
            print (sys.stdout)
            print (%s)
    """ % obj)
    result = testdir.runpytest("--capture=%s" % method)
    result.stdout.fnmatch_lines([
        "*1 passed*"
    ])

Example 23

Project: tox-pyenv
Source File: test_tox_pyenv.py
View license
    def test_is_precisely_correct_version(self):

        toxenvname = 'TOX_%s' % os.environ['TOX_ENV_NAME'].upper()
        expected_string = os.environ[toxenvname]
        print('\n\nTOX ENV NAME: %s' % toxenvname)
        if platform.python_implementation() == 'PyPy':
            actual_list = [str(_) for _ in sys.pypy_version_info[:3]]
            expected_string = expected_string.split('-')[1]
            print('\nExpected version for this tox env: PyPy %s'
                  % expected_string)
            print('Actual version for this tox env: PyPy %s'
                  % '.'.join(actual_list))
        else:
            print('\nExpected version for this tox env: Python %s'
                  % expected_string)
            print('Actual version for this tox env: Python %s'
                  % platform.python_version())
            actual_list = list(platform.python_version_tuple())
        expected_list = expected_string.split('.')

        print('\n\nPYTHON VERSION (verbose)')
        print('*************************')
        print(sys.version)
        print('\n')
        self.assertEqual(actual_list, expected_list)