mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Mock both kinds of decision tasks
This commit is contained in:
parent
ed55b8c1e6
commit
efd62ea677
2 changed files with 13 additions and 5 deletions
|
@ -76,6 +76,7 @@ def linux_tidy_unit():
|
||||||
./mach package --dev
|
./mach package --dev
|
||||||
./mach test-tidy --no-progress --self-test
|
./mach test-tidy --no-progress --self-test
|
||||||
python2.7 ./etc/memory_reports_over_time.py --test
|
python2.7 ./etc/memory_reports_over_time.py --test
|
||||||
|
python3 ./etc/ci/taskcluster/mock.py
|
||||||
./etc/ci/lockfile_changed.sh
|
./etc/ci/lockfile_changed.sh
|
||||||
./etc/ci/check_no_panic.sh
|
./etc/ci/check_no_panic.sh
|
||||||
""",
|
""",
|
||||||
|
|
|
@ -15,7 +15,6 @@ Run the decision task with fake Taskcluster APIs, to catch Python errors before
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import collections
|
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,15 +23,23 @@ class TaskclusterRestFailure(Exception):
|
||||||
|
|
||||||
|
|
||||||
class Index:
|
class Index:
|
||||||
def __init__(self, options):
|
__init__ = insertTask = lambda *_, **__: None
|
||||||
pass
|
|
||||||
|
|
||||||
def findTask(self, _):
|
def findTask(self, _):
|
||||||
raise TaskclusterRestFailure
|
raise TaskclusterRestFailure
|
||||||
|
|
||||||
|
|
||||||
Queue = stringDate = fromNow = slugId = MagicMock()
|
Queue = stringDate = fromNow = slugId = MagicMock()
|
||||||
os.environ = collections.defaultdict(str, TASK_FOR="github-push")
|
|
||||||
sys.modules["taskcluster"] = sys.modules[__name__]
|
sys.modules["taskcluster"] = sys.modules[__name__]
|
||||||
sys.dont_write_bytecode = True
|
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue