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


Python test_support.threading_setup方法代码示例

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


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

示例1: test_main

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def test_main():
    tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest,
             TestExceptions, BufferIOTest, BasicTCPTest2, BasicUDPTest,
             UDPTimeoutTest ]

    tests.extend([
        NonBlockingTCPTests,
        FileObjectClassTestCase,
        FileObjectInterruptedTestCase,
        UnbufferedFileObjectClassTestCase,
        LineBufferedFileObjectClassTestCase,
        SmallBufferedFileObjectClassTestCase,
        Urllib2FileobjectTest,
        NetworkConnectionNoServer,
        NetworkConnectionAttributesTest,
        NetworkConnectionBehaviourTest,
    ])
    tests.append(BasicSocketPairTest)
    tests.append(TestLinuxAbstractNamespace)
    tests.extend([TIPCTest, TIPCThreadableTest])

    thread_info = test_support.threading_setup()
    test_support.run_unittest(*tests)
    test_support.threading_cleanup(*thread_info) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:26,代码来源:test_socket.py

示例2: setUp

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def setUp(self):
        # temporarily replace sys.stdout to capture DebuggingServer output
        self.old_stdout = sys.stdout
        self.output = StringIO.StringIO()
        sys.stdout = self.output

        self._threads = test_support.threading_setup()
        self.serv_evt = threading.Event()
        self.client_evt = threading.Event()
        # Pick a random unused port by passing 0 for the port number
        self.serv = smtpd.DebuggingServer((HOST, 0), ('nowhere', -1))
        # Keep a note of what port was assigned
        self.port = self.serv.socket.getsockname()[1]
        serv_args = (self.serv, self.serv_evt, self.client_evt)
        self.thread = threading.Thread(target=debugging_server, args=serv_args)
        self.thread.start()

        # wait until server thread has assigned a port number
        self.serv_evt.wait()
        self.serv_evt.clear() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:test_smtplib.py

示例3: test_main

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def test_main():
    tests = [TestFTPClass, TestTimeouts]
    if socket.has_ipv6:
        try:
            DummyFTPServer((HOST, 0), af=socket.AF_INET6)
        except socket.error:
            pass
        else:
            tests.append(TestIPv6Environment)

    if ssl is not None:
        tests.extend([TestTLS_FTPClassMixin, TestTLS_FTPClass])

    thread_info = test_support.threading_setup()
    try:
        test_support.run_unittest(*tests)
    finally:
        test_support.threading_cleanup(*thread_info) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:20,代码来源:test_ftplib.py

示例4: test_main

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def test_main(self):
        threads = []
        thread_info = threading_setup()

        for i in range(NUM_THREADS):
            t = TempFileGreedy()
            threads.append(t)
            t.start()

        startEvent.set()

        ok = 0
        errors = []
        for t in threads:
            t.join()
            ok += t.ok_count
            if t.error_count:
                errors.append(str(t.getName()) + str(t.errors.getvalue()))

        threading_cleanup(*thread_info)

        msg = "Errors: errors %d ok %d\n%s" % (len(errors), ok,
            '\n'.join(errors))
        self.assertEqual(errors, [], msg)
        self.assertEqual(ok, NUM_THREADS * FILES_PER_THREAD) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:27,代码来源:test_threadedtempfile.py

示例5: test_main

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def test_main():
    tests = [TestFTPClass, TestTimeouts,
             TestIPv6Environment,
             TestTLS_FTPClassMixin, TestTLS_FTPClass]

    thread_info = test_support.threading_setup()
    try:
        test_support.run_unittest(*tests)
    finally:
        test_support.threading_cleanup(*thread_info) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_ftplib.py

示例6: setUp

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def setUp(self):
        self._threads = test_support.threading_setup() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:test_urllib2_localnet.py

示例7: setUp

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def setUp(self):
        self._threads = test_support.threading_setup()
        self.f = None
        self.filename = TESTFN
        with open(self.filename, "w") as f:
            f.write("\n".join("0123456789"))
        self._count_lock = threading.Lock()
        self.close_count = 0
        self.close_success_count = 0
        self.use_buffering = False 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_file2k.py

示例8: setUp

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def setUp(self):
        self._threads = support.threading_setup() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:lock_tests.py

示例9: setUp

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def setUp(self):
        self._threads = test_support.threading_setup()
        os.environ = test_support.EnvironmentVarGuard()
        self.server_started = threading.Event()
        self.thread = TestServerThread(self, self.request_handler)
        self.thread.start()
        self.server_started.wait() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_httpservers.py

示例10: setUp

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def setUp (self):
        self._threads = test_support.threading_setup() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:test_asynchat.py

示例11: test_main

# 需要导入模块: from test import test_support [as 别名]
# 或者: from test.test_support import threading_setup [as 别名]
def test_main():
    tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest,
             TestExceptions, BufferIOTest, BasicTCPTest2, BasicUDPTest,
             UDPTimeoutTest ]

    tests.extend([
        NonBlockingTCPTests,
        FileObjectClassTestCase,
        FileObjectInterruptedTestCase,
        UnbufferedFileObjectClassTestCase,
        LineBufferedFileObjectClassTestCase,
        SmallBufferedFileObjectClassTestCase,
        Urllib2FileobjectTest,
        NetworkConnectionNoServer,
        NetworkConnectionAttributesTest,
        NetworkConnectionBehaviourTest,
    ])
    if hasattr(socket, "socketpair"):
        tests.append(BasicSocketPairTest)
    if sys.platform == 'linux2':
        tests.append(TestLinuxAbstractNamespace)
    if isTipcAvailable():
        tests.append(TIPCTest)
        tests.append(TIPCThreadableTest)

    thread_info = test_support.threading_setup()
    test_support.run_unittest(*tests)
    test_support.threading_cleanup(*thread_info) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:30,代码来源:test_socket.py


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