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

Side by Side Diff: tools/vim/tests/chromium.ycm_extra_conf_unittest.py

Issue 2303813002: Fix the YCM tests on Mac. (Closed)
Patch Set: Proper fix for symlinks in the path returned from tempfile.mkdtemp() Created 4 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
« no previous file with comments | « tools/vim/ninja_output.py ('k') | no next file » | 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/env python 1 #!/usr/bin/env python
2 2
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. 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 """Tests for chromium.ycm_extra_conf. 7 """Tests for chromium.ycm_extra_conf.
8 8
9 These tests should be getting picked up by the PRESUBMIT.py in /tools/vim. 9 These tests should be getting picked up by the PRESUBMIT.py in /tools/vim.
10 Currently the tests only run on Linux and require 'ninja' to be available on 10 Currently the tests only run on Linux and require 'ninja' to be available on
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 | | DEPS 67 | | DEPS
68 | | three.cc 68 | | three.cc
69 | | 69 | |
70 | +-- .git 70 | +-- .git
71 | 71 |
72 +-- out 72 +-- out
73 | 73 |
74 +-- gn 74 +-- gn
75 build.ninja 75 build.ninja
76 """ 76 """
77 self.chrome_root = os.path.abspath(os.path.normpath( 77 self.chrome_root = os.path.join(self.test_root, 'src')
78 os.path.join(self.test_root, 'src')))
79 self.out_dir = os.path.join(self.chrome_root, 'out', 'gn') 78 self.out_dir = os.path.join(self.chrome_root, 'out', 'gn')
80 79
81 os.makedirs(self.chrome_root) 80 os.makedirs(self.chrome_root)
82 os.makedirs(os.path.join(self.chrome_root, '.git')) 81 os.makedirs(os.path.join(self.chrome_root, '.git'))
83 os.makedirs(self.out_dir) 82 os.makedirs(self.out_dir)
84 83
85 CreateFile(os.path.join(self.test_root, '.gclient')) 84 CreateFile(os.path.join(self.test_root, '.gclient'))
86 CreateFile(os.path.join(self.chrome_root, 'DEPS')) 85 CreateFile(os.path.join(self.chrome_root, 'DEPS'))
87 CreateFile(os.path.join(self.chrome_root, 'three.cc')) 86 CreateFile(os.path.join(self.chrome_root, 'three.cc'))
88 87
(...skipping 12 matching lines...) Expand all
101 return [self.NormalizeString(s) for s in list_of_strings] 100 return [self.NormalizeString(s) for s in list_of_strings]
102 101
103 def setUp(self): 102 def setUp(self):
104 self.actual_chrome_root = os.path.normpath( 103 self.actual_chrome_root = os.path.normpath(
105 os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../..')) 104 os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../..'))
106 sys.path.append(os.path.join(self.actual_chrome_root, 'tools', 'vim')) 105 sys.path.append(os.path.join(self.actual_chrome_root, 'tools', 'vim'))
107 self.test_data_path = os.path.join(self.actual_chrome_root, 'tools', 'vim', 106 self.test_data_path = os.path.join(self.actual_chrome_root, 'tools', 'vim',
108 'tests', 'data') 107 'tests', 'data')
109 self.ycm_extra_conf = imp.load_source('ycm_extra_conf', 108 self.ycm_extra_conf = imp.load_source('ycm_extra_conf',
110 'chromium.ycm_extra_conf.py') 109 'chromium.ycm_extra_conf.py')
111 self.test_root = tempfile.mkdtemp() 110 self.test_root = os.path.realpath(tempfile.mkdtemp())
asanka 2016/09/02 15:05:13 Shall we avoid calling realpath() here and try to
Sidney San Martín 2016/09/09 14:55:49 I like it :). See the latest patch set — some uses
112 self.SetUpFakeChromeTreeBelowPath() 111 self.SetUpFakeChromeTreeBelowPath()
113 112
114 def tearDown(self): 113 def tearDown(self):
115 if self.test_root: 114 if self.test_root:
116 shutil.rmtree(self.test_root) 115 shutil.rmtree(self.test_root)
117 116
118 def testNinjaIsAvailable(self): 117 def testNinjaIsAvailable(self):
119 p = subprocess.Popen(['ninja', '--version'], stdout=subprocess.PIPE) 118 p = subprocess.Popen(['ninja', '--version'], stdout=subprocess.PIPE)
120 _, _ = p.communicate() 119 _, _ = p.communicate()
121 self.assertFalse(p.returncode) 120 self.assertFalse(p.returncode)
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 '-Wno-unknown-warning-option', 384 '-Wno-unknown-warning-option',
386 '-I[OUT]/a', 385 '-I[OUT]/a',
387 '--sysroot=[SRC]/build/sysroot-image', 386 '--sysroot=[SRC]/build/sysroot-image',
388 ]) 387 ])
389 388
390 if __name__ == '__main__': 389 if __name__ == '__main__':
391 if not os.path.isfile('chromium.ycm_extra_conf.py'): 390 if not os.path.isfile('chromium.ycm_extra_conf.py'):
392 print('The test must be run from src/tools/vim/ directory') 391 print('The test must be run from src/tools/vim/ directory')
393 sys.exit(1) 392 sys.exit(1)
394 unittest.main() 393 unittest.main()
OLDNEW
« no previous file with comments | « tools/vim/ninja_output.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698