Add unit tests for read_keyval, and fix a bug in its handling of
comments+whitespace found while writing the tests.
Risk: Low
Visibility: Adds more unittests.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1833 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index 2d5cb8d..f31fb2f 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -25,7 +25,7 @@
path = os.path.join(path, 'keyval')
keyval = {}
for line in open(path):
- line = re.sub('#.*', '', line.rstrip())
+ line = re.sub('#.*', '', line).rstrip()
if not re.search(r'^[-\w]+=', line):
raise ValueError('Invalid format line: %s' % line)
key, value = line.split('=', 1)