コード例 #1
0
def test_agregator(phout, expected_rps):
    generator = PhantomMock(phout)
    aggregator = TankAggregator(generator)
    listener = ListenerMock(expected_rps)
    aggregator.add_result_listener(listener)
    aggregator.start_test(poll_period=0)
    while not generator.reader.closed:
        aggregator.is_test_finished()
    aggregator.end_test(1)
    assert abs(listener.avg - expected_rps) < 0.1 * expected_rps
コード例 #2
0
def test_agregator(phout, expected_rps):
    generator = PhantomMock(os.path.join(PATH, phout))
    aggregator = TankAggregator(generator)
    listener = ListenerMock(expected_rps)
    aggregator.add_result_listener(listener)
    aggregator.start_test(poll_period=0)
    generator.finished.set()
    while not aggregator.is_aggr_finished():
        aggregator.is_test_finished()
    aggregator.end_test(1)
    assert abs(listener.avg - expected_rps) < 0.1 * expected_rps