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

Side by Side Diff: native_client_sdk/src/project_templates/init_project_test.py

Issue 10910101: fix pylint warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for init_project.py.""" 6 """Unit tests for init_project.py."""
7 7
8 __author__ = 'mlinck@google.com (Michael Linck)' 8 __author__ = 'mlinck@google.com (Michael Linck)'
9 9
10 import fileinput 10 import fileinput
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 output = init_project.ParseArguments(['-n', 'test_name_2', '-c']) 80 output = init_project.ParseArguments(['-n', 'test_name_2', '-c'])
81 self.assertEqual(output.is_c_project, True) 81 self.assertEqual(output.is_c_project, True)
82 self.assertEqual(output.project_name, 'test_name_2') 82 self.assertEqual(output.project_name, 'test_name_2')
83 self.assertEqual(output.project_directory, 83 self.assertEqual(output.project_directory,
84 init_project.GetDefaultProjectDir()) 84 init_project.GetDefaultProjectDir())
85 85
86 86
87 class TestProjectInitializer(unittest.TestCase): 87 class TestProjectInitializer(unittest.TestCase):
88 """Class for test cases to cover public interface of ProjectInitializer.""" 88 """Class for test cases to cover public interface of ProjectInitializer."""
89 89
90 def __init__(self):
91 unittest.TestCase.__init__(self)
92 self.os_mock = None
93 self.fileinput_mock = None
94 self.sys_mock = None
95 self.shutil_mock = None
96
90 def setUp(self): 97 def setUp(self):
91 self.script_dir = os.path.abspath(os.path.dirname(__file__)) 98 self.script_dir = os.path.abspath(os.path.dirname(__file__))
92 self.nacl_src_dir = os.getenv('NACL_SDK_ROOT', None) 99 self.nacl_src_dir = os.getenv('NACL_SDK_ROOT', None)
93 self.mock_factory = mox.Mox() 100 self.mock_factory = mox.Mox()
94 # This mock is only valid for initialization and will be overwritten 101 # This mock is only valid for initialization and will be overwritten
95 # after ward by self.os_mock. 102 # after ward by self.os_mock.
96 init_path_mock = self.mock_factory.CreateMock(os.path) 103 init_path_mock = self.mock_factory.CreateMock(os.path)
97 init_path_mock.join('test/dir', 'test_project').AndReturn( 104 init_path_mock.join('test/dir', 'test_project').AndReturn(
98 'test/dir/test_project') 105 'test/dir/test_project')
99 init_path_mock.exists('test/dir/test_project').AndReturn(False) 106 init_path_mock.exists('test/dir/test_project').AndReturn(False)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 suite_two = unittest.TestLoader().loadTestsFromTestCase( 254 suite_two = unittest.TestLoader().loadTestsFromTestCase(
248 TestProjectInitializer) 255 TestProjectInitializer)
249 result_two = unittest.TextTestRunner(verbosity=2).run(suite_two) 256 result_two = unittest.TextTestRunner(verbosity=2).run(suite_two)
250 if result_one.wasSuccessful() and result_two.wasSuccessful(): 257 if result_one.wasSuccessful() and result_two.wasSuccessful():
251 return_value = 0 258 return_value = 0
252 return return_value 259 return return_value
253 260
254 261
255 if __name__ == '__main__': 262 if __name__ == '__main__':
256 sys.exit(RunTests()) 263 sys.exit(RunTests())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698