Bug 1288220 - Adding a from_json() class method to TestTask. r=dustin draft
authorKalpesh Krishna <kalpeshk2011@gmail.com>
Thu, 21 Jul 2016 01:27:21 +0530
changeset 390194 6289426112ff17c61f7151bc8e448978d1cc85e8
parent 389960 ed8e23b5e0c7b739e61173bb180cf3410a306679
child 525948 5f2445e658b21d3d7fc5bc7fde5e0ed6dbc45771
push id23616
push userbmo:kalpeshk2011@gmail.com
push dateWed, 20 Jul 2016 20:00:10 +0000
reviewersdustin
bugs1288220
milestone50.0a1
Bug 1288220 - Adding a from_json() class method to TestTask. r=dustin MozReview-Commit-ID: 5HYb4jf4ATT
taskcluster/taskgraph/task/test.py
--- a/taskcluster/taskgraph/task/test.py
+++ b/taskcluster/taskgraph/task/test.py
@@ -136,16 +136,22 @@ class TestTask(base.Task):
     def load_transforms(cls, transforms_cfg):
         """Load the transforms specified in kind.yml"""
         transforms = []
         for path in transforms_cfg:
             transform = find_object(path)
             transforms.append(transform)
         return transforms
 
+    @classmethod
+    def from_json(cls, task_dict):
+        test_task = cls(kind=task_dict['attributes']['kind'],
+                        task=task_dict)
+        return test_task
+
     def __init__(self, kind, task):
         self.dependencies = task['dependencies']
         super(TestTask, self).__init__(kind, task['label'], task['attributes'], task['task'])
 
     def get_dependencies(self, taskgraph):
         return [(label, name) for name, label in self.dependencies.items()]
 
     def optimize(self):