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


Python test_support.unload方法代码示例

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


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

示例1: tearDown

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def tearDown(self):
        if self.xx_created:
            test_support.unload('xx')
            # XXX on Windows the test leaves a directory
            # with xx module in TEMP
        super(BuildExtTestCase, self).tearDown() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:test_build_ext.py

示例2: testBlocker

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def testBlocker(self):
        mname = "exceptions"  # an arbitrary harmless builtin module
        test_support.unload(mname)
        sys.meta_path.append(ImportBlocker(mname))
        self.assertRaises(ImportError, __import__, mname) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:test_importhooks.py

示例3: test_future1

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def test_future1(self):
        test_support.unload('test_future1')
        from test import test_future1
        self.assertEqual(test_future1.result, 6) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:test_future.py

示例4: test_future2

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def test_future2(self):
        test_support.unload('test_future2')
        from test import test_future2
        self.assertEqual(test_future2.result, 6) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:test_future.py

示例5: test_future3

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def test_future3(self):
        test_support.unload('test_future3')
        from test import test_future3 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_future.py

示例6: runtest_inner

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def runtest_inner(test, verbose, quiet, huntrleaks=False):
    test_support.unload(test)
    if verbose:
        capture_stdout = None
    else:
        capture_stdout = StringIO.StringIO()

    test_time = 0.0
    refleak = False  # True if the test leaked references.
    try:
        save_stdout = sys.stdout
        try:
            if capture_stdout:
                sys.stdout = capture_stdout
            if test.startswith('test.'):
                abstest = test
            else:
                # Always import it from the test package
                abstest = 'test.' + test
            with saved_test_environment(test, verbose, quiet) as environment:
                start_time = time.time()
                the_package = __import__(abstest, globals(), locals(), [])
                the_module = getattr(the_package, test)
                # Old tests run to completion simply as a side-effect of
                # being imported.  For tests based on unittest or doctest,
                # explicitly invoke their test_main() function (if it exists).
                indirect_test = getattr(the_module, "test_main", None)
                if indirect_test is not None:
                    indirect_test()
                if huntrleaks:
                    refleak = dash_R(the_module, test, indirect_test,
                        huntrleaks)
                test_time = time.time() - start_time
        finally:
            sys.stdout = save_stdout
    except test_support.ResourceDenied, msg:
        if not quiet:
            print test, "skipped --", msg
            sys.stdout.flush()
        return RESOURCE_DENIED, test_time 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:42,代码来源:regrtest.py

示例7: tearDown

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def tearDown(self):
        # Get everything back to normal
        if os.path.exists(_XX_MODULE_PATH):
            test_support.unload('xx')
            sys.path[:] = self.sys_path
            # XXX on Windows the test leaves a directory
            # with xx module in TEMP
        shutil.rmtree(self.tmp_dir, os.name == 'nt' or
                                    sys.platform == 'cygwin')
        super(BuildExtTestCase, self).tearDown() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:12,代码来源:test_build_ext.py

示例8: test_multiple_features

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def test_multiple_features(self):
        test_support.unload("test.test_future5")
        from test import test_future5 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:5,代码来源:test_future.py

示例9: unload

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def unload(self, test):
            pass 
开发者ID:jlachowski,项目名称:clonedigger,代码行数:4,代码来源:testlib.py

示例10: run_test

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import unload [as 别名]
def run_test(test, verbose, runner=None, capture=0):
    """
    Run a single test.

    test -- the name of the test
    verbose -- if true, print more messages
    """
    test_support.unload(test)
    try:
        m = load_module_from_name(test, path=sys.path)
#        m = __import__(test, globals(), locals(), sys.path)
        try:
            suite = m.suite
            if callable(suite):
                suite = suite()
        except AttributeError:
            loader = unittest.TestLoader()
            suite = loader.loadTestsFromModule(m)
        if runner is None:
            runner = SkipAwareTextTestRunner(capture=capture) # verbosity=0)
        return runner.run(suite)
    except KeyboardInterrupt as v:
        raise KeyboardInterrupt, v, sys.exc_info()[2]
    except:
        # raise
        type, value = sys.exc_info()[:2]
        msg = "test %s crashed -- %s : %s" % (test, type, value)
        if verbose:
            traceback.print_exc()
        return msg 
开发者ID:jlachowski,项目名称:clonedigger,代码行数:32,代码来源:testlib.py


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