Commit 1037c743 authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

presubmit: Don't overwrite cwd when running tests.

Sometimes 'cwd' has already been specified, for example by GetPythonUnitTests.
Don't overwrite it if it has been.

TBR=agable@chromium.org

Bug: 829084
Change-Id: Ide65c2811bcdd2628d4e886227d634dc66bfd297
Reviewed-on: https://chromium-review.googlesource.com/1038665Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent 1eb58e1f
......@@ -785,7 +785,8 @@ class InputApi(object):
tests.append(t)
if self.verbose:
t.info = _PresubmitNotifyResult
t.kwargs['cwd'] = self.PresubmitLocalPath()
if not t.kwargs.get('cwd'):
t.kwargs['cwd'] = self.PresubmitLocalPath()
self.thread_pool.AddTests(tests, parallel)
if not self.parallel:
msgs.extend(self.thread_pool.RunAsync())
......
......@@ -2785,8 +2785,6 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api = self.MockInputApi(change, False)
input_api.verbose = True
unit_tests = ['allo', 'bar.py']
input_api.PresubmitLocalPath().AndReturn(self.fake_root_dir)
input_api.PresubmitLocalPath().AndReturn(self.fake_root_dir)
cmd = ['bar.py', '--verbose']
if input_api.platform == 'win32':
cmd.insert(0, 'vpython.bat')
......@@ -2814,7 +2812,6 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.verbose = True
input_api.logging = self.mox.CreateMock(logging)
input_api.PresubmitLocalPath().AndReturn(self.fake_root_dir)
input_api.PresubmitLocalPath().AndReturn(self.fake_root_dir)
path = presubmit.os.path.join(self.fake_root_dir, 'random_directory')
input_api.os_listdir(path).AndReturn(['.', '..', 'a', 'b', 'c'])
input_api.os_path.isfile = lambda x: not x.endswith('.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment