OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 Google Inc. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Runs small tests. | 8 Runs small tests. |
9 """ | 9 """ |
10 | 10 |
11 import imp | 11 import imp |
12 import os | 12 import os |
13 import sys | 13 import sys |
14 import unittest | 14 import unittest |
15 | 15 |
16 import TestGyp | 16 import TestGyp |
17 | 17 |
18 | 18 |
19 test = TestGyp.TestGyp() | 19 test = TestGyp.TestGyp() |
20 | 20 |
21 # Add pylib to the import path (so tests can import their dependencies). | 21 # Add pylib to the import path (so tests can import their dependencies). |
22 # This is consistant with the path.append done in the top file "gyp". | 22 # This is consistant with the path.append done in the top file "gyp". |
23 sys.path.append(os.path.join(test._cwd, 'pylib')) | 23 sys.path.insert(0, os.path.join(test._cwd, 'pylib')) |
24 | 24 |
25 # Add new test suites here. | 25 # Add new test suites here. |
26 files_to_test = [ | 26 files_to_test = [ |
27 'pylib/gyp/MSVSSettings_test.py', | 27 'pylib/gyp/MSVSSettings_test.py', |
28 'pylib/gyp/easy_xml_test.py', | 28 'pylib/gyp/easy_xml_test.py', |
29 'pylib/gyp/generator/msvs_test.py', | 29 'pylib/gyp/generator/msvs_test.py', |
30 'pylib/gyp/generator/ninja_test.py', | 30 'pylib/gyp/generator/ninja_test.py', |
31 'pylib/gyp/generator/xcode_test.py', | 31 'pylib/gyp/generator/xcode_test.py', |
32 'pylib/gyp/common_test.py', | 32 'pylib/gyp/common_test.py', |
33 'pylib/gyp/input_test.py', | 33 'pylib/gyp/input_test.py', |
(...skipping 12 matching lines...) Expand all Loading... |
46 suites.append(unittest.defaultTestLoader.loadTestsFromModule(module)) | 46 suites.append(unittest.defaultTestLoader.loadTestsFromModule(module)) |
47 # Create combined suite. | 47 # Create combined suite. |
48 all_tests = unittest.TestSuite(suites) | 48 all_tests = unittest.TestSuite(suites) |
49 | 49 |
50 # Run all the tests. | 50 # Run all the tests. |
51 result = unittest.TextTestRunner(verbosity=2).run(all_tests) | 51 result = unittest.TextTestRunner(verbosity=2).run(all_tests) |
52 if result.failures or result.errors: | 52 if result.failures or result.errors: |
53 test.fail_test() | 53 test.fail_test() |
54 | 54 |
55 test.pass_test() | 55 test.pass_test() |
OLD | NEW |