Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1812)

Side by Side Diff: client/common_lib/global_config_unittest.py

Issue 4823005: Merge remote branch 'cros/upstream' into tempbranch (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: patch Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/common_lib/control_data_unittest.py ('k') | client/common_lib/utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import os, sys, unittest, types 3 import os, sys, unittest, types
4 import common 4 import common
5 from autotest_lib.client.common_lib import global_config 5 from autotest_lib.client.common_lib import global_config
6 from autotest_lib.client.common_lib import autotemp 6 from autotest_lib.client.common_lib import autotemp
7 7
8 8
9 global_config_ini_contents = """ 9 global_config_ini_contents = """
10 [SECTION_A] 10 [SECTION_A]
(...skipping 17 matching lines...) Expand all
28 shadow_config_ini_contents = """ 28 shadow_config_ini_contents = """
29 [SECTION_C] 29 [SECTION_C]
30 value_1: somebody@remotehost 30 value_1: somebody@remotehost
31 """ 31 """
32 32
33 33
34 def create_config_files(): 34 def create_config_files():
35 global_temp = autotemp.tempfile("global", ".ini", 35 global_temp = autotemp.tempfile("global", ".ini",
36 text=True) 36 text=True)
37 os.write(global_temp.fd, global_config_ini_contents) 37 os.write(global_temp.fd, global_config_ini_contents)
38 os.close(global_temp.fd)
39 38
40 shadow_temp = autotemp.tempfile("shadow", ".ini", 39 shadow_temp = autotemp.tempfile("shadow", ".ini",
41 text=True) 40 text=True)
42 fd = shadow_temp.fd 41 fd = shadow_temp.fd
43 os.write(shadow_temp.fd, shadow_config_ini_contents) 42 os.write(shadow_temp.fd, shadow_config_ini_contents)
44 os.close(shadow_temp.fd)
45 43
46 return (global_temp, shadow_temp) 44 return (global_temp, shadow_temp)
47 45
48 46
49 class global_config_test(unittest.TestCase): 47 class global_config_test(unittest.TestCase):
50 # grab the singelton 48 # grab the singelton
51 conf = global_config.global_config 49 conf = global_config.global_config
52 50
53 def setUp(self): 51 def setUp(self):
54 # set the config files to our test files 52 # set the config files to our test files
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 val = self.conf.get_config_value("MISSING", "foo", float, 3.6) 114 val = self.conf.get_config_value("MISSING", "foo", float, 3.6)
117 self.assertEquals(val, 3.6) 115 self.assertEquals(val, 3.6)
118 val = self.conf.get_config_value("SECTION_A", "novalue", str, 116 val = self.conf.get_config_value("SECTION_A", "novalue", str,
119 "default") 117 "default")
120 self.assertEquals(val, "default") 118 self.assertEquals(val, "default")
121 119
122 120
123 # this is so the test can be run in standalone mode 121 # this is so the test can be run in standalone mode
124 if __name__ == '__main__': 122 if __name__ == '__main__':
125 unittest.main() 123 unittest.main()
OLDNEW
« no previous file with comments | « client/common_lib/control_data_unittest.py ('k') | client/common_lib/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698