async def test_counters(c, s, a, b): pytest.importorskip("crick") while "tick-duration" not in a.digests: await asyncio.sleep(0.01) aa = Counters(a) aa.update() await asyncio.sleep(0.1) aa.update() start = time() while not len(aa.digest_sources["tick-duration"][0].data["x"]): await asyncio.sleep(1) assert time() < start + 5 a.digests["foo"].add(1) a.digests["foo"].add(2) aa.add_digest_figure("foo") a.counters["bar"].add(1) a.counters["bar"].add(2) a.counters["bar"].add(2) aa.add_counter_figure("bar") for x in [aa.counter_sources.values(), aa.digest_sources.values()]: for y in x: for z in y.values(): assert len(set(map(len, z.data.values()))) == 1
async def test_counters(c, s, a, b): pytest.importorskip("crick") while "tick-duration" not in s.digests: await asyncio.sleep(0.01) ss = Counters(s) ss.update() await asyncio.sleep(0.1) ss.update() while not len(ss.digest_sources["tick-duration"][0].data["x"]): await asyncio.sleep(0.01)
def test_counters(c, s, a, b): pytest.importorskip("crick") while "tick-duration" not in s.digests: yield gen.sleep(0.01) ss = Counters(s) ss.update() yield gen.sleep(0.1) ss.update() start = time() while not len(ss.digest_sources["tick-duration"][0].data["x"]): yield gen.sleep(1) assert time() < start + 5