| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 import os, sys, unittest | 3 import os, sys, unittest |
| 4 import common | 4 import common |
| 5 from autotest_lib.client.common_lib import control_data, autotemp | 5 from autotest_lib.client.common_lib import control_data, autotemp |
| 6 | 6 |
| 7 ControlData = control_data.ControlData | 7 ControlData = control_data.ControlData |
| 8 | 8 |
| 9 CONTROL = """ | 9 CONTROL = """ |
| 10 AUTHOR = 'Author' | 10 AUTHOR = 'Author' |
| 11 DEPENDENCIES = "console, power" | 11 DEPENDENCIES = "console, power" |
| 12 DOC = \"\"\"\ | 12 DOC = \"\"\"\ |
| 13 doc stuff\"\"\" | 13 doc stuff\"\"\" |
| 14 # EXPERIMENTAL should implicitly be False | 14 # EXPERIMENTAL should implicitly be False |
| 15 NAME = 'nA' "mE" | 15 NAME = 'nA' "mE" |
| 16 RUN_VERIFY = False | 16 RUN_VERIFY = False |
| 17 SYNC_COUNT = 2 | 17 SYNC_COUNT = 2 |
| 18 TIME='short' | 18 TIME='short' |
| 19 TEST_CLASS=u'Kernel' | 19 TEST_CLASS=u'Kernel' |
| 20 TEST_CATEGORY='Stress' | 20 TEST_CATEGORY='Stress' |
| 21 TEST_TYPE='client' | 21 TEST_TYPE='client' |
| 22 """ | 22 """ |
| 23 | 23 |
| 24 | 24 |
| 25 class ParseControlTest(unittest.TestCase): | 25 class ParseControlTest(unittest.TestCase): |
| 26 def setUp(self): | 26 def setUp(self): |
| 27 self.control_tmp = autotemp.tempfile(unique_id='control_unit', | 27 self.control_tmp = autotemp.tempfile(unique_id='control_unit', |
| 28 text=True) | 28 text=True) |
| 29 os.write(self.control_tmp.fd, CONTROL) | 29 os.write(self.control_tmp.fd, CONTROL) |
| 30 os.close(self.control_tmp.fd) | |
| 31 | 30 |
| 32 | 31 |
| 33 def tearDown(self): | 32 def tearDown(self): |
| 34 self.control_tmp.clean() | 33 self.control_tmp.clean() |
| 35 | 34 |
| 36 | 35 |
| 37 def test_parse_control(self): | 36 def test_parse_control(self): |
| 38 cd = control_data.parse_control(self.control_tmp.name, True) | 37 cd = control_data.parse_control(self.control_tmp.name, True) |
| 39 self.assertEquals(cd.author, "Author") | 38 self.assertEquals(cd.author, "Author") |
| 40 self.assertEquals(cd.dependencies, set(['console', 'power'])) | 39 self.assertEquals(cd.dependencies, set(['console', 'power'])) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 'foo', 1, options) | 132 'foo', 1, options) |
| 134 self.assertRaises(ValueError, cd._set_option, | 133 self.assertRaises(ValueError, cd._set_option, |
| 135 'foo', [], options) | 134 'foo', [], options) |
| 136 self.assertRaises(ValueError, cd._set_option, | 135 self.assertRaises(ValueError, cd._set_option, |
| 137 'foo', None, options) | 136 'foo', None, options) |
| 138 | 137 |
| 139 | 138 |
| 140 # this is so the test can be run in standalone mode | 139 # this is so the test can be run in standalone mode |
| 141 if __name__ == '__main__': | 140 if __name__ == '__main__': |
| 142 unittest.main() | 141 unittest.main() |
| OLD | NEW |