Mercurial > hg
comparison tests/run-tests.py @ 32621:c59451e11cbf
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.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 30 May 2017 20:47:00 -0400 |
parents | 7b7f55d56076 |
children | 931bb962e0eb |
comparison
equal
deleted
inserted
replaced
32620:3ce53a499334 | 32621:c59451e11cbf |
---|---|
1765 def job(test, result): | 1765 def job(test, result): |
1766 for n, v in enumerate(channels): | 1766 for n, v in enumerate(channels): |
1767 if not v: | 1767 if not v: |
1768 channel = n | 1768 channel = n |
1769 break | 1769 break |
1770 else: | |
1771 raise ValueError('Could not find output channel') | |
1770 channels[channel] = "=" + test.name[5:].split(".")[0] | 1772 channels[channel] = "=" + test.name[5:].split(".")[0] |
1771 try: | 1773 try: |
1772 test(result) | 1774 test(result) |
1773 done.put(None) | 1775 done.put(None) |
1774 except KeyboardInterrupt: | 1776 except KeyboardInterrupt: |