diff --git a/etc/ci/taskcluster/decision-task.py b/etc/ci/taskcluster/decision-task.py index 351990798cf..10936733958 100644 --- a/etc/ci/taskcluster/decision-task.py +++ b/etc/ci/taskcluster/decision-task.py @@ -76,6 +76,7 @@ def linux_tidy_unit(): ./mach package --dev ./mach test-tidy --no-progress --self-test python2.7 ./etc/memory_reports_over_time.py --test + python3 ./etc/ci/taskcluster/mock.py ./etc/ci/lockfile_changed.sh ./etc/ci/check_no_panic.sh """, diff --git a/etc/ci/taskcluster/mock.py b/etc/ci/taskcluster/mock.py index 2060521a994..085c82c2917 100755 --- a/etc/ci/taskcluster/mock.py +++ b/etc/ci/taskcluster/mock.py @@ -15,7 +15,6 @@ Run the decision task with fake Taskcluster APIs, to catch Python errors before import os import sys -import collections from unittest.mock import MagicMock @@ -24,15 +23,23 @@ class TaskclusterRestFailure(Exception): class Index: - def __init__(self, options): - pass + __init__ = insertTask = lambda *_, **__: None def findTask(self, _): raise TaskclusterRestFailure Queue = stringDate = fromNow = slugId = MagicMock() -os.environ = collections.defaultdict(str, TASK_FOR="github-push") sys.modules["taskcluster"] = sys.modules[__name__] sys.dont_write_bytecode = True -exec(open(os.path.join(os.path.dirname(__file__), "decision-task.py")).read()) +code = open(os.path.join(os.path.dirname(__file__), "decision-task.py"), "rb").read() +for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_REF GIT_SHA".split(): + os.environ[k] = k + +print("Push:") +os.environ["TASK_FOR"] = "github-push" +exec(code) + +print("Daily:") +os.environ["TASK_FOR"] = "daily" +exec(code)