• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python option.make_config函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pypy.tool.option.make_config函数的典型用法代码示例。如果您正苦于以下问题:Python make_config函数的具体用法?Python make_config怎么用?Python make_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了make_config函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_abi_tag

 def test_abi_tag(self):
     space1 = maketestobjspace(make_config(None, soabi="TEST"))
     space2 = maketestobjspace(make_config(None, soabi=""))
     if sys.platform == "win32":
         assert importing.get_so_extension(space1) == ".TESTi.pyd"
         assert importing.get_so_extension(space2) == ".pyd"
     else:
         assert importing.get_so_extension(space1) == ".TESTi.so"
         assert importing.get_so_extension(space2) == ".so"
开发者ID:cimarieta,项目名称:usp,代码行数:9,代码来源:test_import.py


示例2: test_abi_tag

 def test_abi_tag(self):
     space1 = maketestobjspace(make_config(None, soabi='TEST'))
     space2 = maketestobjspace(make_config(None, soabi=''))
     if sys.platform == 'win32':
         assert importing.get_so_extension(space1) == '.TESTi.pyd'
         assert importing.get_so_extension(space2) == '.pyd'
     else:
         assert importing.get_so_extension(space1) == '.TESTi.so'
         assert importing.get_so_extension(space2) == '.so'
开发者ID:yuyichao,项目名称:pypy,代码行数:9,代码来源:test_import.py


示例3: translates

 def translates(self, func=None, argtypes=None, seeobj_w=[], **kwds):
     config = make_config(None, **kwds)
     if func is not None:
         if argtypes is None:
             nb_args = func.func_code.co_argcount
             argtypes = [W_Root] * nb_args
     #
     t = TranslationContext(config=config)
     self.t = t     # for debugging
     ann = t.buildannotator()
     def _do_startup():
         self.threadlocals.enter_thread(self)
     ann.build_types(_do_startup, [], complete_now=False)
     if func is not None:
         ann.build_types(func, argtypes, complete_now=False)
     if seeobj_w:
         def seeme(n):
             return seeobj_w[n]
         ann.build_types(seeme, [int], complete_now=False)
     #
     # annotate all _seen_extras, knowing that annotating some may
     # grow the list
     done = 0
     while done < len(self._seen_extras):
         #print self._seen_extras
         ann.build_types(self._seen_extras[done], [],
                         complete_now=False)
         ann.complete_pending_blocks()
         done += 1
     ann.complete()
     assert done == len(self._seen_extras)
     #t.viewcg()
     t.buildrtyper().specialize()
     t.checkgraphs()
开发者ID:mozillazg,项目名称:pypy,代码行数:34,代码来源:objspace.py


示例4: test_pyc_magic_changes

 def test_pyc_magic_changes(self):
     py.test.skip("For now, PyPy generates only one kind of .pyc files")
     # test that the pyc files produced by a space are not reimportable
     # from another, if they differ in what opcodes they support
     allspaces = [self.space]
     for opcodename in self.space.config.objspace.opcodes.getpaths():
         key = 'objspace.opcodes.' + opcodename
         space2 = maketestobjspace(make_config(None, **{key: True}))
         allspaces.append(space2)
     for space1 in allspaces:
         for space2 in allspaces:
             if space1 is space2:
                 continue
             pathname = "whatever"
             mtime = 12345
             co = compile('x = 42', '?', 'exec')
             cpathname = _testfile(importing.get_pyc_magic(space1),
                                   mtime, co)
             w_modulename = space2.wrap('somemodule')
             stream = streamio.open_file_as_stream(cpathname, "rb")
             try:
                 w_mod = space2.wrap(Module(space2, w_modulename))
                 magic = importing._r_long(stream)
                 timestamp = importing._r_long(stream)
                 space2.raises_w(space2.w_ImportError,
                                 importing.load_compiled_module,
                                 space2,
                                 w_modulename,
                                 w_mod,
                                 cpathname,
                                 magic,
                                 timestamp,
                                 stream.readall())
             finally:
                 stream.close()
开发者ID:yuyichao,项目名称:pypy,代码行数:35,代码来源:test_import.py


示例5: gettestobjspace

def gettestobjspace(name=None, **kwds):
    """ helper for instantiating and caching space's for testing.
    """
    try:
        config = make_config(option, objspace=name, **kwds)
    except ConflictConfigError, e:
        # this exception is typically only raised if a module is not available.
        # in this case the test should be skipped
        py.test.skip(str(e))
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:9,代码来源:conftest.py


示例6: test_dont_reload_builtin_mods_on_startup

 def test_dont_reload_builtin_mods_on_startup(self):
     from pypy.tool.option import make_config, make_objspace
     config = make_config(None)
     space = make_objspace(config)
     w_executable = space.wrap('executable')
     assert space.str_w(space.getattr(space.sys, w_executable)) == 'py.py'
     space.setattr(space.sys, w_executable, space.wrap('foobar'))
     assert space.str_w(space.getattr(space.sys, w_executable)) == 'foobar'
     space.startup()
     assert space.str_w(space.getattr(space.sys, w_executable)) == 'foobar'
开发者ID:Sherlockhlt,项目名称:pypy,代码行数:10,代码来源:test_objspace.py


示例7: test_dont_reload_builtin_mods_on_startup

    def test_dont_reload_builtin_mods_on_startup(self):
        from pypy.tool.option import make_config, make_objspace

        config = make_config(None)
        space = make_objspace(config)
        w_executable = space.wrap("executable")
        assert space.findattr(space.sys, w_executable) is None
        space.setattr(space.sys, w_executable, space.wrap("foobar"))
        assert space.str_w(space.getattr(space.sys, w_executable)) == "foobar"
        space.startup()
        assert space.str_w(space.getattr(space.sys, w_executable)) == "foobar"
开发者ID:mozillazg,项目名称:pypy,代码行数:11,代码来源:test_objspace.py


示例8: maketestobjspace

def maketestobjspace(config=None):
    if config is None:
        config = make_config(option)
    try:
        space = make_objspace(config)
    except OperationError, e:
        check_keyboard_interrupt(e)
        if option.verbose:
            import traceback
            traceback.print_exc()
        py.test.fail("fatal: cannot initialize objspace: %r" %
                         (config.objspace.name,))
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:12,代码来源:conftest.py


示例9: maketestobjspace

def maketestobjspace(config=None):
    if config is None:
        config = make_config(option)
    space = make_objspace(config)
    space.startup() # Initialize all builtin modules
    space.setitem(space.builtin.w_dict, space.wrap('AssertionError'),
                  appsupport.build_pytest_assertion(space))
    space.setitem(space.builtin.w_dict, space.wrap('raises'),
                  space.wrap(appsupport.app_raises))
    space.setitem(space.builtin.w_dict, space.wrap('skip'),
                  space.wrap(appsupport.app_skip))
    space.raises_w = appsupport.raises_w.__get__(space)
    return space
开发者ID:Darriall,项目名称:pypy,代码行数:13,代码来源:objspace.py


示例10: test_flush_at_exit

def test_flush_at_exit():
    from pypy import conftest
    from pypy.tool.option import make_config, make_objspace
    from rpython.tool.udir import udir

    tmpfile = udir.join('test_flush_at_exit')
    config = make_config(conftest.option)
    space = make_objspace(config)
    space.appexec([space.wrap(str(tmpfile))], """(tmpfile):
        f = open(tmpfile, 'w')
        f.write('42')
        # no flush() and no close()
        import sys; sys._keepalivesomewhereobscure = f
    """)
    space.finish()
    assert tmpfile.read() == '42'
开发者ID:kipras,项目名称:pypy,代码行数:16,代码来源:test_file.py


示例11: gettestobjspace

def gettestobjspace(name=None, **kwds):
    """ helper for instantiating and caching space's for testing. 
    """ 
    config = make_config(option, objspace=name, **kwds)
    key = config.getkey()
    try:
        return _SPACECACHE[key]
    except KeyError:
        if option.runappdirect:
            if name not in (None, 'std'):
                myname = getattr(sys, 'pypy_objspaceclass', '')
                if not myname.lower().startswith(name):
                    py.test.skip("cannot runappdirect test: "
                                 "%s objspace required" % (name,))
            return TinyObjSpace(**kwds)
        space = maketestobjspace(config)
        _SPACECACHE[key] = space
        return space
开发者ID:antoine1fr,项目名称:pygirl,代码行数:18,代码来源:conftest.py


示例12: gettestobjspace

def gettestobjspace(**kwds):
    """ helper for instantiating and caching space's for testing.
    """
    try:
        config = make_config(option,**kwds)
    except ConflictConfigError as e:
        # this exception is typically only raised if a module is not available.
        # in this case the test should be skipped
        py.test.skip(str(e))
    key = config.getkey()
    try:
        return _SPACECACHE[key]
    except KeyError:
        if getattr(option, 'runappdirect', None):
            return TinyObjSpace(**kwds)
        space = maketestobjspace(config)
        _SPACECACHE[key] = space
        return space
开发者ID:mozillazg,项目名称:pypy,代码行数:18,代码来源:objspace.py


示例13: test_flush_at_exit_IOError_and_ValueError

def test_flush_at_exit_IOError_and_ValueError():
    from pypy import conftest
    from pypy.tool.option import make_config, make_objspace

    config = make_config(conftest.option)
    space = make_objspace(config)
    space.appexec([], """():
        import io
        class MyStream(io.IOBase):
            def flush(self):
                raise IOError

        class MyStream2(io.IOBase):
            def flush(self):
                raise ValueError

        s = MyStream()
        s2 = MyStream2()
        import sys; sys._keepalivesomewhereobscure = s
    """)
    space.finish() # the IOError has been ignored
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:21,代码来源:test_fileio.py


示例14: test_startup

    def test_startup(self):
        config = make_config(None, usemodules=('_demo',))
        space = make_objspace(config)
        w_modules = space.sys.get('modules')

        assert _demo.Module.demo_events == ['setup']
        assert not space.contains_w(w_modules, space.wrap('_demo'))

        # first import
        w_import = space.builtin.get('__import__')
        w_demo = space.call(w_import,
                            space.newlist([space.wrap('_demo')]))
        assert _demo.Module.demo_events == ['setup', 'startup']

        # reload the module, this should not call startup again
        space.delitem(w_modules,
                      space.wrap('_demo'))
        w_demo = space.call(w_import,
                            space.newlist([space.wrap('_demo')]))
        assert _demo.Module.demo_events == ['setup', 'startup']

        assert space.getattr(w_demo, space.wrap('measuretime'))
开发者ID:abhinavthomas,项目名称:pypy,代码行数:22,代码来源:test_import.py



注:本文中的pypy.tool.option.make_config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python option.make_objspace函数代码示例发布时间:2022-05-27
下一篇:
Python rffi_platform.configure函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap