Ignore lines in tests files that start with #
If a line begins with #, it is treated as a comment, and ignored.
BUG=chromium:592738
TEST=Put a tests file in the same directory as script. Then run:
$ ./browsertest_status.py --tests_file=tests
Change-Id: I593d4ed69a61b7dd3502e1553b9051a942cbe26c
Reviewed-on: https://chromium-review.googlesource.com/331320
Commit-Ready: Scott Cunningham <scunningham@chromium.org>
Tested-by: Scott Cunningham <scunningham@chromium.org>
Reviewed-by: Scott Cunningham <scunningham@chromium.org>
diff --git a/provingground/browsertest_status.py b/provingground/browsertest_status.py
index 82e7769..27486ba 100755
--- a/provingground/browsertest_status.py
+++ b/provingground/browsertest_status.py
@@ -52,7 +52,8 @@
File must be a text file, formatted with one line per test. Leading and
trailing spaces and blanklines are stripped from the test list. If a line
- still contains a space return only the first word (to remove comments).
+ still contains a space, return only the first word (to remove comments). If
+ the first character on line is '#', then ignore line (to remove comments).
Args:
tests_file: Path and name of tests file.
@@ -63,7 +64,7 @@
print('\nReading user-specified tests from: %s' % tests_file)
content = open(tests_file, 'r').read().strip()
user_tests = [line.strip().split()[0] for line in content.splitlines()
- if line.strip()]
+ if line.strip() and line.strip()[0][0] is not '#']
if not user_tests:
print('Error: tests file is empty.')
sys.exit(2)