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

Side by Side Diff: scripts/slave/unittests/annotated_run_test.py

Issue 1879173003: annotated_run: extract robust_tempdir so it can be shared with kitchen_run (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: review Created 4 years, 8 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
« no previous file with comments | « scripts/slave/robust_tempdir.py ('k') | scripts/slave/unittests/robust_tempdir_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 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 that the tools/build annotated_run wrapper actually runs.""" 7 """Tests that the tools/build annotated_run wrapper actually runs."""
8 8
9 import collections 9 import collections
10 import contextlib 10 import contextlib
11 import json 11 import json
12 import logging 12 import logging
13 import os 13 import os
14 import subprocess 14 import subprocess
15 import sys 15 import sys
16 import tempfile 16 import tempfile
17 import unittest 17 import unittest
18 18
19 import test_env # pylint: disable=W0403,W0611 19 import test_env # pylint: disable=W0403,W0611
20 20
21 import mock 21 import mock
22 from common import chromium_utils 22 from common import chromium_utils
23 from common import env 23 from common import env
24 from slave import annotated_run 24 from slave import annotated_run
25 from slave import gce 25 from slave import gce
26 from slave import infra_platform 26 from slave import infra_platform
27 from slave import robust_tempdir
27 from slave import update_scripts 28 from slave import update_scripts
28 29
29 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 30 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
30 31
31 32
32 MockOptions = collections.namedtuple('MockOptions', 33 MockOptions = collections.namedtuple('MockOptions',
33 ('dry_run', 'logdog_force', 'logdog_butler_path', 'logdog_annotee_path', 34 ('dry_run', 'logdog_force', 'logdog_butler_path', 'logdog_annotee_path',
34 'logdog_verbose', 'logdog_service_account_json', 'logdog_pubsub_topic', 35 'logdog_verbose', 'logdog_service_account_json', 'logdog_pubsub_topic',
35 'logdog_host')) 36 'logdog_host'))
36 37
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 self.maxDiff = None 86 self.maxDiff = None
86 self._patchers = [] 87 self._patchers = []
87 map(self._patch, ( 88 map(self._patch, (
88 mock.patch('slave.annotated_run._run_command'), 89 mock.patch('slave.annotated_run._run_command'),
89 mock.patch('slave.infra_platform.get'), 90 mock.patch('slave.infra_platform.get'),
90 mock.patch('os.path.exists'), 91 mock.patch('os.path.exists'),
91 mock.patch('os.getcwd'), 92 mock.patch('os.getcwd'),
92 mock.patch('os.environ', {}), 93 mock.patch('os.environ', {}),
93 )) 94 ))
94 95
95 self.rt = annotated_run.Runtime() 96 self.rt = robust_tempdir.RobustTempdir(prefix='annotated_run_test')
96 self.basedir = self.rt.tempdir() 97 self.basedir = self.rt.tempdir()
97 self.tdir = self.rt.tempdir() 98 self.tdir = self.rt.tempdir()
98 self.opts = MockOptions( 99 self.opts = MockOptions(
99 dry_run=False, 100 dry_run=False,
100 logdog_force=False, 101 logdog_force=False,
101 logdog_annotee_path=None, 102 logdog_annotee_path=None,
102 logdog_butler_path=None, 103 logdog_butler_path=None,
103 logdog_verbose=False, 104 logdog_verbose=False,
104 logdog_service_account_json=None, 105 logdog_service_account_json=None,
105 logdog_pubsub_topic=None, 106 logdog_pubsub_topic=None,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 392
392 def test_will_not_bootstrap_if_recursive(self): 393 def test_will_not_bootstrap_if_recursive(self):
393 os.environ['LOGDOG_STREAM_PREFIX'] = 'foo' 394 os.environ['LOGDOG_STREAM_PREFIX'] = 'foo'
394 self.assertRaises(annotated_run.LogDogNotBootstrapped, 395 self.assertRaises(annotated_run.LogDogNotBootstrapped,
395 annotated_run._logdog_bootstrap, self.rt, self.opts, self.basedir, 396 annotated_run._logdog_bootstrap, self.rt, self.opts, self.basedir,
396 self.tdir, self._config(), self.properties, []) 397 self.tdir, self._config(), self.properties, [])
397 398
398 399
399 if __name__ == '__main__': 400 if __name__ == '__main__':
400 unittest.main() 401 unittest.main()
OLDNEW
« no previous file with comments | « scripts/slave/robust_tempdir.py ('k') | scripts/slave/unittests/robust_tempdir_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698