Esempio n. 1
0
def filters_from_included_tasks(included_tasks):
    filters = []
    if included_tasks:
        for t in included_tasks:
            spec = t.split(":")
            if len(spec) == 1:
                filters.append(track.TaskNameFilter(spec[0]))
            elif len(spec) == 2:
                if spec[0] == "type":
                    filters.append(track.TaskOpTypeFilter(spec[1]))
                else:
                    raise exceptions.SystemSetupError("Invalid format for included tasks: [%s]. Expected [type] but got [%s]." % (t, spec[0]))
            else:
                raise exceptions.SystemSetupError("Invalid format for included tasks: [%s]" % t)
    return filters
Esempio n. 2
0
 def test_task_name_filter(self):
     f = track.TaskNameFilter("create-index-task")
     self.assertTrue(f.matches(self.create_index_task()))
     self.assertFalse(f.matches(self.search_task()))
Esempio n. 3
0
 def test_task_name_filter(self):
     f = track.TaskNameFilter("create-index-task")
     assert f.matches(self.create_index_task())
     assert not f.matches(self.search_task())