Bug 1638990: [taskgraph] Make test_create pass on python 3; r=ahal

Differential Revision: https://phabricator.services.mozilla.com/D84079
This commit is contained in:
Tom Prince 2020-07-20 19:27:19 +00:00
Родитель e99a78f6de
Коммит f4bb27e422
2 изменённых файлов: 6 добавлений и 14 удалений

Просмотреть файл

@ -9,6 +9,8 @@ import json
import sys
import logging
import six
from slugid import nice as slugid
from taskgraph.util.parameterization import resolve_timestamps
from taskgraph.util.time import current_json_time
@ -21,7 +23,7 @@ testing = False
def create_tasks(graph_config, taskgraph, label_to_taskid, params, decision_task_id):
taskid_to_label = {t: l for l, t in label_to_taskid.iteritems()}
taskid_to_label = {t: l for l, t in six.iteritems(label_to_taskid)}
# when running as an actual decision task, we use the decision task's
# taskId as the taskGroupId. The process that created the decision task

Просмотреть файл

@ -4,10 +4,9 @@
from __future__ import absolute_import, print_function, unicode_literals
import sys
import unittest
import mock
import pytest
from taskgraph import create
from taskgraph.config import GraphConfig
@ -33,9 +32,6 @@ class TestCreate(unittest.TestCase):
def fake_create_task(self, session, task_id, label, task_def):
self.created_tasks[task_id] = task_def
@pytest.mark.xfail(
sys.version_info >= (3, 0), reason="python3 migration is not complete"
)
def test_create_tasks(self):
tasks = {
'tid-a': Task(kind='test', label='a', attributes={}, task={'payload': 'hello world'}),
@ -53,7 +49,7 @@ class TestCreate(unittest.TestCase):
decision_task_id="decisiontask",
)
for tid, task in self.created_tasks.iteritems():
for tid, task in self.created_tasks.items():
self.assertEqual(task['payload'], 'hello world')
self.assertEqual(task['schedulerId'], 'domain-level-4')
# make sure the dependencies exist, at least
@ -63,9 +59,6 @@ class TestCreate(unittest.TestCase):
continue
self.assertIn(depid, self.created_tasks)
@pytest.mark.xfail(
sys.version_info >= (3, 0), reason="python3 migration is not complete"
)
def test_create_task_without_dependencies(self):
"a task with no dependencies depends on the decision task"
tasks = {
@ -83,12 +76,9 @@ class TestCreate(unittest.TestCase):
decision_task_id="decisiontask",
)
for tid, task in self.created_tasks.iteritems():
for tid, task in self.created_tasks.items():
self.assertEqual(task.get('dependencies'), ["decisiontask"])
@pytest.mark.xfail(
sys.version_info >= (3, 0), reason="python3 migration is not complete"
)
@mock.patch('taskgraph.create.create_task')
def test_create_tasks_fails_if_create_fails(self, create_task):
"creat_tasks fails if a single create_task call fails"