[autotest] Fix busted unit test.
testCreateFromNonexistentConfig() was broken by b535e25 due to not
raising the correct exception if we try to create a task from a section
that does not exist in a config file.
BUG=None
TEST=unit
Change-Id: Ie8da6d0d46e1d181577aa0e4914bfb534d094973
Reviewed-on: https://gerrit.chromium.org/gerrit/27764
Tested-by: Alex Miller <milleral@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Ready: Alex Miller <milleral@chromium.org>
diff --git a/site_utils/suite_scheduler/task.py b/site_utils/suite_scheduler/task.py
index 4033aea..b0c2456 100644
--- a/site_utils/suite_scheduler/task.py
+++ b/site_utils/suite_scheduler/task.py
@@ -53,6 +53,9 @@
@return keyword, Task object pair. One or both will be None on error.
@raise MalformedConfigEntry if there's a problem parsing |section|.
"""
+ if not config.has_section(section):
+ raise MalformedConfigEntry('unknown section %s' % section)
+
allowed = set(['suite', 'run_on', 'branch_specs', 'pool'])
# The parameter of union() is the keys under the section in the config
# The union merges this with the allowed set, so if any optional keys