Exemplo n.º 1
0
    def test_each_log(self):
        data = [{
            "action": "action_0",
            "data": "data_0"
        }, {
            "action": "action_1",
            "data": "data_1"
        }]

        f = self.to_file_like(data)

        count = {"action_0": 0, "action_1": 0}

        def f_action_0(item):
            count[item["action"]] += 1

        def f_action_1(item):
            count[item["action"]] += 2

        reader.each_log(reader.read(f), {
            "action_0": f_action_0,
            "action_1": f_action_1
        })

        self.assertEquals({"action_0": 1, "action_1": 2}, count)
Exemplo n.º 2
0
Arquivo: reduce.py Projeto: sw811/wpt
    def log_is_unstable(self, log_f):
        log_f.seek(0)

        statuses = defaultdict(set)

        def handle_status(item):
            if item["test"] == self.target:
                statuses[item["subtest"]].add(item["status"])

        def handle_end(item):
            if item["test"] == self.target:
                statuses[None].add(item["status"])

        reader.each_log(reader.read(log_f),
                        {"test_status": handle_status,
                         "test_end": handle_end})

        logger.debug(str(statuses))

        if not statuses:
            logger.error("Didn't get any useful output from wptrunner")
            log_f.seek(0)
            for item in reader.read(log_f):
                logger.debug(item)
            return None

        return any(len(item) > 1 for item in statuses.itervalues())
Exemplo n.º 3
0
    def test_each_log(self):
        data = [{"action": "action_0", "data": "data_0"},
                {"action": "action_1", "data": "data_1"}]

        f = self.to_file_like(data)

        count = {"action_0": 0,
                 "action_1": 0}

        def f_action_0(item):
            count[item["action"]] += 1

        def f_action_1(item):
            count[item["action"]] += 2

        reader.each_log(reader.read(f),
                        {"action_0": f_action_0,
                         "action_1": f_action_1})

        self.assertEquals({"action_0": 1, "action_1": 2}, count)
Exemplo n.º 4
0
 def update_from_log(self, log_file):
     self.run_info = None
     log_reader = reader.read(log_file)
     reader.each_log(log_reader, self.action_map)
Exemplo n.º 5
0
 def update_from_log(self, log_file):
     self.run_info = None
     log_reader = reader.read(log_file)
     reader.each_log(log_reader, self.action_map)