OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Tests for the cmd_helper module.""" | 5 """Tests for the cmd_helper module.""" |
6 | 6 |
7 import unittest | 7 import unittest |
8 import subprocess | 8 import subprocess |
9 | 9 |
10 from pylib import cmd_helper | 10 from devil.utils import cmd_helper |
11 | 11 |
12 | 12 |
13 class CmdHelperSingleQuoteTest(unittest.TestCase): | 13 class CmdHelperSingleQuoteTest(unittest.TestCase): |
14 | 14 |
15 def testSingleQuote_basic(self): | 15 def testSingleQuote_basic(self): |
16 self.assertEquals('hello', | 16 self.assertEquals('hello', |
17 cmd_helper.SingleQuote('hello')) | 17 cmd_helper.SingleQuote('hello')) |
18 | 18 |
19 def testSingleQuote_withSpaces(self): | 19 def testSingleQuote_withSpaces(self): |
20 self.assertEquals("'hello world'", | 20 self.assertEquals("'hello world'", |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 self.assertEquals(num, int(line)) | 74 self.assertEquals(num, int(line)) |
75 | 75 |
76 def testIterCmdOutputLines_exitStatusSkipped(self): | 76 def testIterCmdOutputLines_exitStatusSkipped(self): |
77 for num, line in enumerate( | 77 for num, line in enumerate( |
78 cmd_helper.IterCmdOutputLines('seq 10 && false', shell=True), 1): | 78 cmd_helper.IterCmdOutputLines('seq 10 && false', shell=True), 1): |
79 self.assertEquals(num, int(line)) | 79 self.assertEquals(num, int(line)) |
80 # no exception will be raised because we don't attempt to read past | 80 # no exception will be raised because we don't attempt to read past |
81 # the end of the output and, thus, the status never gets checked | 81 # the end of the output and, thus, the status never gets checked |
82 if num == 10: | 82 if num == 10: |
83 break | 83 break |
OLD | NEW |