當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。