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()
评论列表
文章目录