def test_fork(self): collection = stats.fork() stats.incr("widgets", 5) self.assertEquals({"widgets": 5}, collection.get_counter_stats()) self.assertEquals({"widgets": 5}, stats.get_counter_stats(reset=True)) stats.incr("widgets", 5) self.assertEquals({"widgets": 10}, collection.get_counter_stats()) self.assertEquals({"widgets": 5}, stats.get_counter_stats(reset=True))
def __init__(self): self.hourly = {} self.hourly_timings = {} self.last_collection = time.time() self.stats = stats.fork()