aboutsummaryrefslogtreecommitdiffstats
path: root/etc/taskcluster/mock.py
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-10-09 11:37:38 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-10-09 14:00:25 +0200
commit09d8339b465f3171c4b24ce8b94e43e09d03a176 (patch)
tree9cece3bdc60733b54121ab0aae6d5e4be92790cd /etc/taskcluster/mock.py
parent62e4f7072b6a2a9245324fead0c78f70c16234ae (diff)
downloadservo-09d8339b465f3171c4b24ce8b94e43e09d03a176.tar.gz
servo-09d8339b465f3171c4b24ce8b94e43e09d03a176.zip
Code coverage for decisionlib
Diffstat (limited to 'etc/taskcluster/mock.py')
-rwxr-xr-xetc/taskcluster/mock.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/etc/taskcluster/mock.py b/etc/taskcluster/mock.py
index 02d55beb1a6..d3e19d88080 100755
--- a/etc/taskcluster/mock.py
+++ b/etc/taskcluster/mock.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/bin/bash
# Copyright 2018 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
@@ -9,6 +9,12 @@
# option. This file may not be copied, modified, or distributed
# except according to those terms.
+''''set -e
+python3 -m coverage run $0
+python3 -m coverage report -m --fail-under 100
+exit
+'''
+
"""
Run the decision task with fake Taskcluster APIs, to catch Python errors before pushing.
"""
@@ -29,7 +35,9 @@ class Index:
raise TaskclusterRestFailure
-Queue = stringDate = fromNow = slugId = MagicMock()
+stringDate = str
+slugId = b"id".lower
+Queue = fromNow = MagicMock()
sys.modules["taskcluster"] = sys.modules[__name__]
sys.dont_write_bytecode = True
os.environ.update(**{k: k for k in "TASK_ID TASK_OWNER TASK_SOURCE GIT_URL GIT_SHA".split()})