Пример #1
0
    def configure(impl, **kwargs):
        """Configures the AsyncHTTPClient subclass to use.

        AsyncHTTPClient() actually creates an instance of a subclass.
        This method may be called with either a class object or the
        fully-qualified name of such a class (or None to use the default,
        SimpleAsyncHTTPClient)

        If additional keyword arguments are given, they will be passed
        to the constructor of each subclass instance created.  The
        keyword argument max_clients determines the maximum number of
        simultaneous fetch() operations that can execute in parallel
        on each IOLoop.  Additional arguments may be supported depending
        on the implementation class in use.

        Example::

           AsyncHTTPClient.configure("anzu.curl_httpclient.CurlAsyncHTTPClient")
        """
        if isinstance(impl, (unicode, bytes_type)):
            impl = import_object(impl)
        if impl is not None and not issubclass(impl, AsyncHTTPClient):
            raise ValueError("Invalid AsyncHTTPClient implementation")
        AsyncHTTPClient._impl_class = impl
        AsyncHTTPClient._impl_kwargs = kwargs
Пример #2
0
    # available in Twisted 11.0.0.  Tests that do not currently pass
    # with the TornadoReactor are commented out.
    twisted_tests = [
        'twisted.internet.test.test_core.ObjectModelIntegrationTest',
        #'twisted.internet.test.test_core.SystemEventTestsBuilder',
        'twisted.internet.test.test_fdset.ReactorFDSetTestsBuilder',
        #'twisted.internet.test.test_process.ProcessTestsBuilder',
        #'twisted.internet.test.test_process.PTYProcessTestsBuilder',
        #'twisted.internet.test.test_tcp.TCPClientTestsBuilder',
        'twisted.internet.test.test_tcp.TCPPortTestsBuilder',
        'twisted.internet.test.test_tcp.TCPConnectionTestsBuilder',
        'twisted.internet.test.test_threads.ThreadTestsBuilder',
        'twisted.internet.test.test_time.TimeTestsBuilder',
        #'twisted.internet.test.test_tls.SSLClientTestsMixin',
        'twisted.internet.test.test_udp.UDPServerTestsBuilder',
        #'twisted.internet.test.test_unix.UNIXTestsBuilder',
        #'twisted.internet.test.test_unix.UNIXDatagramTestsBuilder',
        ]
    for test_name in twisted_tests:
        try:
            test = import_object(test_name)
        except (ImportError, AttributeError):
            continue
        class TornadoTest(test):
            _reactors = ["anzu.platform.twisted._TestReactor"]
        TornadoTest.__name__ = test.__name__
        globals().update(TornadoTest.makeTestCaseClasses())

if __name__ == "__main__":
    unittest.main()
Пример #3
0
    twisted_tests = [
        'twisted.internet.test.test_core.ObjectModelIntegrationTest',
        #'twisted.internet.test.test_core.SystemEventTestsBuilder',
        'twisted.internet.test.test_fdset.ReactorFDSetTestsBuilder',
        #'twisted.internet.test.test_process.ProcessTestsBuilder',
        #'twisted.internet.test.test_process.PTYProcessTestsBuilder',
        #'twisted.internet.test.test_tcp.TCPClientTestsBuilder',
        'twisted.internet.test.test_tcp.TCPPortTestsBuilder',
        'twisted.internet.test.test_tcp.TCPConnectionTestsBuilder',
        'twisted.internet.test.test_threads.ThreadTestsBuilder',
        'twisted.internet.test.test_time.TimeTestsBuilder',
        #'twisted.internet.test.test_tls.SSLClientTestsMixin',
        'twisted.internet.test.test_udp.UDPServerTestsBuilder',
        #'twisted.internet.test.test_unix.UNIXTestsBuilder',
        #'twisted.internet.test.test_unix.UNIXDatagramTestsBuilder',
    ]
    for test_name in twisted_tests:
        try:
            test = import_object(test_name)
        except (ImportError, AttributeError):
            continue

        class TornadoTest(test):
            _reactors = ["anzu.platform.twisted._TestReactor"]

        TornadoTest.__name__ = test.__name__
        globals().update(TornadoTest.makeTestCaseClasses())

if __name__ == "__main__":
    unittest.main()