summaryrefslogtreecommitdiff
path: root/client/bin/autotest_utils.py
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-01-15 20:39:11 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-01-15 20:39:11 +0000
commit50989131251a4d900e568b509b15d64d1b2584db (patch)
treee0c3fa724ba8ea393a93fb54aaab03459d0e69f8 /client/bin/autotest_utils.py
parent7981392fc2b94c426d5f3596518d2ee65a59a326 (diff)
I thought it would be handy to have a write_keyval() API call inside test.
That way, code like this: f = open(os.path.join(self.resultdir, 'keyval'), 'a') f.write(results_dictionary) f.close() Could be replaced by this: self.write_keyval(results_dictionary) Other benefits: * keynames can be validated (no whitespace check, etc) * Guarantee that all tests write keyval to resultdir/keyval and not somehwere else by accident Signed-off-by: Mandeep Singh Baines <msb@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@1165 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'client/bin/autotest_utils.py')
-rwxr-xr-xclient/bin/autotest_utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/client/bin/autotest_utils.py b/client/bin/autotest_utils.py
index dae268b8..46281e40 100755
--- a/client/bin/autotest_utils.py
+++ b/client/bin/autotest_utils.py
@@ -589,7 +589,7 @@ def write_keyval(path, dictionary):
# directory name, we assume you want the file to be called keyval
if os.path.isdir(path):
path = os.path.join(path, 'keyval')
- keyval = open(path, 'w')
+ keyval = open(path, 'a')
for key in dictionary.keys():
if re.search(r'\W', key):
raise ValueError('Invalid key: ' + key)