Beispiel #1
0
def test_get_version(space, monkeypatch):
    from pypy.module.sys import version
    monkeypatch.setattr(version, 'PYPY_VERSION', (2,5,0, "final", 1))
    res = space.unwrap(version.get_version(space))
    assert "[PyPy 2.5.0" in res
    monkeypatch.setattr(version, 'PYPY_VERSION', (2,6,3, "alpha", 5))
    res = space.unwrap(version.get_version(space))
    assert "[PyPy 2.6.3-alpha5" in res
Beispiel #2
0
def test_get_version(space, monkeypatch):
    from pypy.module.sys import version

    monkeypatch.setattr(version, "PYPY_VERSION", (2, 5, 0, "final", 1))
    res = space.unwrap(version.get_version(space))
    assert "[PyPy 2.5.0" in res
    monkeypatch.setattr(version, "PYPY_VERSION", (2, 6, 3, "alpha", 5))
    res = space.unwrap(version.get_version(space))
    assert "[PyPy 2.6.3-alpha5" in res
Beispiel #3
0
    def startup(self, space):
        if space.config.translating and not we_are_translated():
            # don't get the filesystemencoding at translation time
            assert self.filesystemencoding is None

        else:
            from pypy.module.sys import version
            space.setitem(self.w_dict, space.wrap("version"),
                          space.wrap(version.get_version(space)))
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.wrap("dllhandle"), w_handle)

        if not space.config.translating:
            # Install standard streams for tests that don't call app_main.
            # Always use line buffering, even for tests that capture
            # standard descriptors.
            space.appexec([], """():
                import sys, io
                sys.stdin = sys.__stdin__ = io.open(0, "r", encoding="ascii",
                                                    closefd=False)
                sys.stdin.buffer.raw.name = "<stdin>"
                sys.stdout = sys.__stdout__ = io.open(1, "w", encoding="ascii",
                                                      buffering=1,
                                                      closefd=False)
                sys.stdout.buffer.raw.name = "<stdout>"
                sys.stderr = sys.__stderr__ = io.open(2, "w", encoding="ascii",
                                                      errors="backslashreplace",
                                                      buffering=1,
                                                      closefd=False)
                sys.stderr.buffer.raw.name = "<stderr>"
               """)
Beispiel #4
0
    def startup(self, space):
        if space.config.translating and not we_are_translated():
            # don't get the filesystemencoding at translation time
            assert self.filesystemencoding is None

        else:
            from pypy.module.sys import version
            space.setitem(self.w_dict, space.wrap("version"),
                          space.wrap(version.get_version(space)))
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.wrap("dllhandle"), w_handle)
Beispiel #5
0
    def startup(self, space):
        if space.config.translating and not we_are_translated():
            # don't get the filesystemencoding at translation time
            assert self.filesystemencoding is None

        else:
            from pypy.module.sys import version
            space.setitem(self.w_dict, space.newtext("version"),
                          version.get_version(space))
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.newtext("dllhandle"), w_handle)
Beispiel #6
0
    def startup(self, space):
        if space.config.translating:
            assert self.filesystemencoding is None

        if not space.config.translating or we_are_translated():
            from pypy.module.sys import version
            space.setitem(self.w_dict, space.newtext("version"),
                          version.get_version(space))
            if _WIN:
                from pypy.module.sys import vm
                w_handle = vm.get_dllhandle(space)
                space.setitem(self.w_dict, space.newtext("dllhandle"), w_handle)

        from pypy.module.sys import system
        thread_info = system.get_thread_info(space)
        if thread_info is not None:
            space.setitem(self.w_dict, space.newtext('thread_info'), thread_info)