1 # Copyright 2018 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
12 class CommandLineTest(unittest.TestCase):
13 # pylint: disable=super-with-arguments
14 def __init__(self, methodName, module):
15 super(CommandLineTest, self).__init__(methodName)
17 # pylint: disable=super-with-arguments
20 self.temp_dir = tempfile.mkdtemp(prefix='common_merge_script_tests')
23 shutil.rmtree(self.temp_dir)
25 def test_accepts_task_output_dir(self):
26 task_output_dir = os.path.join(self.temp_dir, 'task_output_dir')
27 shard0_dir = os.path.join(task_output_dir, '0')
28 os.makedirs(shard0_dir)
29 summary_json = os.path.join(task_output_dir, 'summary.json')
30 with open(summary_json, 'w') as summary_file:
34 u'state': u'COMPLETED',
38 json.dump(summary_contents, summary_file)
40 shard0_json = os.path.join(shard0_dir, 'output.json')
41 with open(shard0_json, 'w') as shard0_file:
42 json.dump({}, shard0_file)
44 output_json = os.path.join(self.temp_dir, 'merged.json')
47 '--task-output-dir', task_output_dir,
48 '--summary-json', summary_json,
49 '--output-json', output_json,
52 self.assertEqual(0, self._module.main(raw_args))