Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
* Renaming `check_stability.run` breaks commands.json and naming
  conventions, so rename the other `run` in that module instead.
* Only return errors for empty results when we know for sure tests are
  affected.
  • Loading branch information
Hexcles committed Mar 20, 2018
1 parent 7e214e8 commit 3a83284
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tools/ci/check_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from tools import localpaths

logger = None
run, write_inconsistent, write_results = None, None, None
stability_run, write_inconsistent, write_results = None, None, None
wptrunner = None

def setup_logging():
Expand All @@ -37,8 +37,9 @@ def setup_logging():


def do_delayed_imports():
global run, write_inconsistent, write_results, wptrunner
from tools.wpt.stability import run, write_inconsistent, write_results
global stability_run, write_inconsistent, write_results, wptrunner
from tools.wpt.stability import run as stability_run
from tools.wpt.stability import write_inconsistent, write_results
from wptrunner import wptrunner


Expand Down Expand Up @@ -250,10 +251,10 @@ def main():
venv.install("requests")

args, wpt_args = get_parser().parse_known_args()
return setup_and_run(venv, wpt_args, **vars(args))
return run(venv, wpt_args, **vars(args))


def setup_and_run(venv, wpt_args, **kwargs):
def run(venv, wpt_args, **kwargs):
do_delayed_imports()

retcode = 0
Expand Down Expand Up @@ -332,7 +333,7 @@ def setup_and_run(venv, wpt_args, **kwargs):


wpt_logger = wptrunner.logger
iterations, results, inconsistent = run(venv, wpt_logger, **wpt_kwargs)
iterations, results, inconsistent = stability_run(venv, wpt_logger, **wpt_kwargs)

if results:
if inconsistent:
Expand All @@ -350,7 +351,9 @@ def setup_and_run(venv, wpt_args, **kwargs):
status="failed" if inconsistent else "passed")
else:
logger.info("No tests run.")
retcode = 3
# Be conservative and only return errors when we know for sure tests are changed.
if tests_changed:
retcode = 3

return retcode

Expand Down

0 comments on commit 3a83284

Please sign in to comment.