当前位置: 首页>>代码示例>>Python>>正文


Python support.import_fresh_module方法代码示例

本文整理汇总了Python中test.support.import_fresh_module方法的典型用法代码示例。如果您正苦于以下问题:Python support.import_fresh_module方法的具体用法?Python support.import_fresh_module怎么用?Python support.import_fresh_module使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test.support的用法示例。


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

示例1: test_import_fresh_module

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import import_fresh_module [as 别名]
def test_import_fresh_module(self):
        support.import_fresh_module("ftplib") 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:test_test_support.py

示例2: testWithoutThreading

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import import_fresh_module [as 别名]
def testWithoutThreading(self):
        module = support.import_fresh_module("bz2", blocked=("threading",))
        with module.BZ2File(self.filename, "wb") as f:
            f.write(b"abc")
        with module.BZ2File(self.filename, "rb") as f:
            self.assertEqual(f.read(), b"abc") 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:8,代码来源:test_bz2.py

示例3: import_importlib

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import import_fresh_module [as 别名]
def import_importlib(module_name):
    """Import a module from importlib both w/ and w/o _frozen_importlib."""
    fresh = ('importlib',) if '.' in module_name else ()
    frozen = support.import_fresh_module(module_name)
    source = support.import_fresh_module(module_name, fresh=fresh,
                                         blocked=('_frozen_importlib', '_frozen_importlib_external'))
    return {'Frozen': frozen, 'Source': source} 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:util.py

示例4: import_importlib

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import import_fresh_module [as 别名]
def import_importlib(module_name):
    """Import a module from importlib both w/ and w/o _frozen_importlib."""
    fresh = ('importlib',) if '.' in module_name else ()
    frozen = support.import_fresh_module(module_name)
    source = support.import_fresh_module(module_name, fresh=fresh,
                                         blocked=('_frozen_importlib',))
    return frozen, source 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:9,代码来源:util.py

示例5: test_main

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import import_fresh_module [as 别名]
def test_main(module=None):
    # When invoked without a module, runs the Python ET tests by loading pyET.
    # Otherwise, uses the given module as the ET.
    global pyET
    pyET = import_fresh_module('xml.etree.ElementTree',
                               blocked=['_elementtree'])
    if module is None:
        module = pyET

    global ET
    ET = module

    test_classes = [
        ModuleTest,
        ElementSlicingTest,
        BasicElementTest,
        BadElementTest,
        BadElementPathTest,
        ElementTreeTest,
        IOTest,
        ParseErrorTest,
        XIncludeTest,
        ElementTreeTypeTest,
        ElementFindTest,
        ElementIterTest,
        TreeBuilderTest,
        XMLParserTest,
        XMLPullParserTest,
        BugsTest,
        ]

    # These tests will only run for the pure-Python version that doesn't import
    # _elementtree. We can't use skipUnless here, because pyET is filled in only
    # after the module is loaded.
    if pyET is not ET:
        test_classes.extend([
            NoAcceleratorTest,
            ])

    try:
        # XXX the C module should give the same warnings as the Python module
        with CleanContext(quiet=(pyET is not ET)):
            support.run_unittest(*test_classes)
    finally:
        # don't interfere with subsequent tests
        ET = pyET = None 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:48,代码来源:test_xml_etree.py


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