test_runners.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:aiolocust 作者: kpidata 项目源码 文件源码
def test_spawn_zero_locusts(self):
        class MyTaskSet(TaskSet):
            @task
            def my_task(self):
                pass

        class MyTestLocust(Locust):
            task_set = MyTaskSet
            min_wait = 100
            max_wait = 100

        runner = LocalLocustRunner([MyTestLocust], self.options)

        timeout = gevent.Timeout(2.0)
        timeout.start()

        try:
            runner.start_hatching(0, 1, wait=True)
            runner.greenlet.join()
        except gevent.Timeout:
            self.fail("Got Timeout exception. A locust seems to have been spawned, even though 0 was specified.")
        finally:
            timeout.cancel()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号