Code coverage for decisionlib

This commit is contained in:
Simon Sapin 2018-10-09 11:37:38 +02:00
parent 62e4f7072b
commit 09d8339b46
7 changed files with 25 additions and 15 deletions

View file

@ -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()})