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

Side by Side Diff: googletest/tests/isolate_test_cases_smoke_test.py

Issue 24813003: Move file path functions into utils/file_path.py. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/tools/swarm_client@master
Patch Set: Fix isolate_test_cases_smoke_test.py Created 7 years, 2 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 | « no previous file | googletest/tests/trace_test_cases_smoke_test.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/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 import hashlib 6 import hashlib
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
11 import shutil 11 import shutil
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 import tempfile 14 import tempfile
15 import unittest 15 import unittest
16 16
17 GOOGLETEST_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 GOOGLETEST_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18 ROOT_DIR = os.path.dirname(GOOGLETEST_DIR) 18 ROOT_DIR = os.path.dirname(GOOGLETEST_DIR)
19 19
20 sys.path.insert(0, GOOGLETEST_DIR) 20 sys.path.insert(0, GOOGLETEST_DIR)
21 sys.path.insert(0, ROOT_DIR) 21 sys.path.insert(0, ROOT_DIR)
22 22
23 import isolate 23 import isolate
24 import trace_test_cases 24 import trace_test_cases
25 from utils import file_path
25 26
26 27
27 class IsolateTestCases(unittest.TestCase): 28 class IsolateTestCases(unittest.TestCase):
28 def setUp(self): 29 def setUp(self):
29 self.tempdir = None 30 self.tempdir = None
30 31
31 self.initial_cwd = ROOT_DIR 32 self.initial_cwd = ROOT_DIR
32 if sys.platform == 'win32': 33 if sys.platform == 'win32':
33 # Windows has no kernel mode concept of current working directory. 34 # Windows has no kernel mode concept of current working directory.
34 self.initial_cwd = None 35 self.initial_cwd = None
35 36
36 # There's 2 kinds of references to python, self.executable, 37 # There's 2 kinds of references to python, self.executable,
37 # self.real_executable. It depends how python was started and on which OS. 38 # self.real_executable. It depends how python was started and on which OS.
38 self.executable = unicode(sys.executable) 39 self.executable = unicode(sys.executable)
39 if sys.platform == 'darwin': 40 if sys.platform == 'darwin':
40 # /usr/bin/python is a thunk executable that decides which version of 41 # /usr/bin/python is a thunk executable that decides which version of
41 # python gets executed. 42 # python gets executed.
42 suffix = '.'.join(map(str, sys.version_info[0:2])) 43 suffix = '.'.join(map(str, sys.version_info[0:2]))
43 if os.access(self.executable + suffix, os.X_OK): 44 if os.access(self.executable + suffix, os.X_OK):
44 # So it'll look like /usr/bin/python2.7 45 # So it'll look like /usr/bin/python2.7
45 self.executable += suffix 46 self.executable += suffix
46 47
47 self.real_executable = isolate.trace_inputs.get_native_path_case( 48 self.real_executable = file_path.get_native_path_case(
48 self.executable) 49 self.executable)
49 # Make sure there's no environment variable that could cause side effects. 50 # Make sure there's no environment variable that could cause side effects.
50 os.environ.pop('GTEST_SHARD_INDEX', '') 51 os.environ.pop('GTEST_SHARD_INDEX', '')
51 os.environ.pop('GTEST_TOTAL_SHARDS', '') 52 os.environ.pop('GTEST_TOTAL_SHARDS', '')
52 53
53 def tearDown(self): 54 def tearDown(self):
54 if self.tempdir: 55 if self.tempdir:
55 if VERBOSE: 56 if VERBOSE:
56 # If -v is used, this means the user wants to do further analisys on 57 # If -v is used, this means the user wants to do further analisys on
57 # the data. 58 # the data.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 }], 211 }],
211 ]), 212 ]),
212 } 213 }
213 self.assertEqual(expected, actual) 214 self.assertEqual(expected, actual)
214 215
215 216
216 if __name__ == '__main__': 217 if __name__ == '__main__':
217 VERBOSE = '-v' in sys.argv 218 VERBOSE = '-v' in sys.argv
218 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 219 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
219 unittest.main() 220 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | googletest/tests/trace_test_cases_smoke_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698