python类testing()的实例源码

utils.py 文件源码 项目:simphony-remote 作者: simphony 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def basic_command_line_config():
    """Returns a basic application config for testing purposes.
    The database is in memory.
    """
    options = {k.replace("-", "_"): remove_quotes(v)
               for k, v in arguments.items()}

    return CommandLineConfig(**options)
utils.py 文件源码 项目:simphony-remote 作者: simphony 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def setUp(self):
        self._bind_unused_port_orig = tornado.testing.bind_unused_port
        tornado.testing.bind_unused_port = bind_unused_port

        def cleanup():
            tornado.testing.bind_unused_port = self._bind_unused_port_orig

        self.addCleanup(cleanup)

        super().setUp()
test_supervisor.py 文件源码 项目:coretools 作者: iotile 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def supervisor():
    """A running supervisor with two connected status clients."""

    info = {
        'expected_services':
        [
            {
                "short_name": "service1",
                "long_name": "Service 1"
            },

            {
                "short_name": "service2",
                "long_name": "Service 2"
            }
        ],
        'port': 'unused'  # Bind an unused port for testing, the value will appear on visor.port after visor.loaded is set
    }

    visor = IOTileSupervisor(info)

    visor.start()
    signaled = visor.loaded.wait(2.0)
    if not signaled:
        raise ValueError("Could not start supervisor service")

    port = visor.port
    client1 = ServiceStatusClient('ws://127.0.0.1:%d/services' % port)

    yield visor, client1

    client1.stop()
    visor.stop()


问题


面经


文章

微信
公众号

扫码关注公众号