當前位置: 首頁>>代碼示例>>Python>>正文


Python unittest.SkipTest方法代碼示例

本文整理匯總了Python中tornado.test.util.unittest.SkipTest方法的典型用法代碼示例。如果您正苦於以下問題:Python unittest.SkipTest方法的具體用法?Python unittest.SkipTest怎麽用?Python unittest.SkipTest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tornado.test.util.unittest的用法示例。


在下文中一共展示了unittest.SkipTest方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def setUp(self):
        if IOLoop.configured_class().__name__ in ('TwistedIOLoop',
                                                  'AsyncIOMainLoop'):
            # TwistedIOLoop only supports the global reactor, so we can't have
            # separate IOLoops for client and server threads.
            # AsyncIOMainLoop doesn't work with the default policy
            # (although it could with some tweaks to this test and a
            # policy that created loops for non-main threads).
            raise unittest.SkipTest(
                'Sync HTTPClient not compatible with TwistedIOLoop or '
                'AsyncIOMainLoop')
        self.server_ioloop = IOLoop()

        sock, self.port = bind_unused_port()
        app = Application([('/', HelloWorldHandler)])
        self.server = HTTPServer(app, io_loop=self.server_ioloop)
        self.server.add_socket(sock)

        self.server_thread = threading.Thread(target=self.server_ioloop.start)
        self.server_thread.start()

        self.http_client = HTTPClient() 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:24,代碼來源:httpclient_test.py

示例2: test_large_read_until

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def test_large_read_until(self):
        # Performance test: read_until used to have a quadratic component
        # so a read_until of 4MB would take 8 seconds; now it takes 0.25
        # seconds.
        server, client = self.make_iostream_pair()
        try:
            # This test fails on pypy with ssl.  I think it's because
            # pypy's gc defeats moves objects, breaking the
            # "frozen write buffer" assumption.
            if (isinstance(server, SSLIOStream) and
                    platform.python_implementation() == 'PyPy'):
                raise unittest.SkipTest(
                    "pypy gc causes problems with openssl")
            NUM_KB = 4096
            for i in range(NUM_KB):
                client.write(b"A" * 1024)
            client.write(b"\r\n")
            server.read_until(b"\r\n", self.stop)
            data = self.wait()
            self.assertEqual(len(data), NUM_KB * 1024 + 2)
        finally:
            server.close()
            client.close() 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:25,代碼來源:iostream_test.py

示例3: test_large_read_until

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def test_large_read_until(self):
        # Performance test: read_until used to have a quadratic component
        # so a read_until of 4MB would take 8 seconds; now it takes 0.25
        # seconds.
        server, client = self.make_iostream_pair()
        try:
            # This test fails on pypy with ssl.  I think it's because
            # pypy's gc defeats moves objects, breaking the
            # "frozen write buffer" assumption.
            if (isinstance(server, MicroProxySSLIOStream) and
                    platform.python_implementation() == 'PyPy'):
                raise unittest.SkipTest(
                    "pypy gc causes problems with openssl")
            NUM_KB = 4096
            for i in range(NUM_KB):
                client.write(b"A" * 1024)
            client.write(b"\r\n")
            server.read_until(b"\r\n", self.stop)
            data = self.wait()
            self.assertEqual(len(data), NUM_KB * 1024 + 2)
        finally:
            server.close()
            client.close() 
開發者ID:mike820324,項目名稱:microProxy,代碼行數:25,代碼來源:test_iostream.py

示例4: setUp

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def setUp(self):
        if IOLoop.configured_class().__name__ == 'TwistedIOLoop':
            # TwistedIOLoop only supports the global reactor, so we can't have
            # separate IOLoops for client and server threads.
            raise unittest.SkipTest(
                'Sync HTTPClient not compatible with TwistedIOLoop')
        self.server_ioloop = IOLoop()

        sock, self.port = bind_unused_port()
        app = Application([('/', HelloWorldHandler)])
        server = HTTPServer(app, io_loop=self.server_ioloop)
        server.add_socket(sock)

        self.server_thread = threading.Thread(target=self.server_ioloop.start)
        self.server_thread.start()

        self.http_client = HTTPClient() 
開發者ID:respeaker,項目名稱:get_started_with_respeaker,代碼行數:19,代碼來源:httpclient_test.py

示例5: test_add_callback_while_closing

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def test_add_callback_while_closing(self):
        # Issue #635: add_callback() should raise a clean exception
        # if called while another thread is closing the IOLoop.
        if IOLoop.configured_class().__name__.endswith('AsyncIOLoop'):
            raise unittest.SkipTest("AsyncIOMainLoop shutdown not thread safe")
        closing = threading.Event()

        def target():
            other_ioloop.add_callback(other_ioloop.stop)
            other_ioloop.start()
            closing.set()
            other_ioloop.close(all_fds=True)
        other_ioloop = IOLoop()
        thread = threading.Thread(target=target)
        thread.start()
        closing.wait()
        for i in range(1000):
            try:
                other_ioloop.add_callback(lambda: None)
            except RuntimeError as e:
                self.assertEqual("IOLoop is closing", str(e))
                break 
開發者ID:Knight-ZXW,項目名稱:aweasome_learning,代碼行數:24,代碼來源:ioloop_test.py

示例6: skip_if_twisted

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def skip_if_twisted():
    if IOLoop.configured_class().__name__.endswith(('TwistedIOLoop',
                                                    'AsyncIOMainLoop')):
        raise unittest.SkipTest("Process tests not compatible with "
                                "TwistedIOLoop or AsyncIOMainLoop")

# Not using AsyncHTTPTestCase because we need control over the IOLoop. 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:9,代碼來源:process_test.py

示例7: test_subprocess

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def test_subprocess(self):
        if IOLoop.configured_class().__name__.endswith('LayeredTwistedIOLoop'):
            # This test fails non-deterministically with LayeredTwistedIOLoop.
            # (the read_until('\n') returns '\n' instead of 'hello\n')
            # This probably indicates a problem with either TornadoReactor
            # or TwistedIOLoop, but I haven't been able to track it down
            # and for now this is just causing spurious travis-ci failures.
            raise unittest.SkipTest("Subprocess tests not compatible with "
                                    "LayeredTwistedIOLoop")
        subproc = Subprocess([sys.executable, '-u', '-i'],
                             stdin=Subprocess.STREAM,
                             stdout=Subprocess.STREAM, stderr=subprocess.STDOUT,
                             io_loop=self.io_loop)
        self.addCleanup(lambda: os.kill(subproc.pid, signal.SIGTERM))
        subproc.stdout.read_until(b'>>> ', self.stop)
        self.wait()
        subproc.stdin.write(b"print('hello')\n")
        subproc.stdout.read_until(b'\n', self.stop)
        data = self.wait()
        self.assertEqual(data, b"hello\n")

        subproc.stdout.read_until(b">>> ", self.stop)
        self.wait()
        subproc.stdin.write(b"raise SystemExit\n")
        subproc.stdout.read_until_close(self.stop)
        data = self.wait()
        self.assertEqual(data, b"") 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:29,代碼來源:process_test.py

示例8: skip_if_twisted

# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import SkipTest [as 別名]
def skip_if_twisted():
    if IOLoop.configured_class().__name__.endswith('TwistedIOLoop'):
        raise unittest.SkipTest("Process tests not compatible with TwistedIOLoop")

# Not using AsyncHTTPTestCase because we need control over the IOLoop. 
開發者ID:respeaker,項目名稱:get_started_with_respeaker,代碼行數:7,代碼來源:process_test.py


注:本文中的tornado.test.util.unittest.SkipTest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。