[PATCH 1 of 2] tests: make run-tests fail early if no channel is found

Augie Fackler raf at durin42.com
Wed May 31 01:12:30 UTC 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1496191620 14400
#      Tue May 30 20:47:00 2017 -0400
# Node ID 361bf17d190dbd3410be4b7fd8ff4d27ddb48739
# Parent  9a0a243342b8a2c4d1f75215615785785844f0cb
tests: make run-tests fail early if no channel is found

I hit a weird corner case in run-tests where a test that caused an
exception to be raised was breaking everything with an unbound
variable error a few lines down because channel was never getting set
in this for loop. By adding an `else` clause to this for loop, we can
explode right away if we can't find a channel and give the developer a
better chance at figuring out what's going on.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1767,6 +1767,8 @@ class TestSuite(unittest.TestSuite):
                 if not v:
                     channel = n
                     break
+            else:
+                raise ValueError('Could not find output channel')
             channels[channel] = "=" + test.name[5:].split(".")[0]
             try:
                 test(result)


More information about the Mercurial-devel mailing list