Exemplo n.º 1
0
 def test_bad_task_bad_lex(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'wrong="command'])
     self.assertIn(
         """invalid task_definition value: 'wrong="command'""",
         err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
Exemplo n.º 2
0
 def test_max_failure_returncode(self):
     """With many tasks the return code is clamped to under 127."""
     definitions = ["t{}=job".format(i) for i in range(101)]
     with patch('concurrently.run_all') as r_mock:
         with patch('concurrently.summarise_tasks',
                    return_value=101) as s_mock:
             returncode = concurrently.main(['-v', '-l', '.'] + definitions)
     self.assertEqual(100, returncode)
     tasks = map(concurrently.Task.from_arg, definitions)
     r_mock.assert_called_once_with(tasks)
     s_mock.assert_called_once_with(tasks)
Exemplo n.º 3
0
 def test_max_failure_returncode(self):
     """With many tasks the return code is clamped to under 127."""
     definitions = ["t{}=job".format(i) for i in range(101)]
     with patch('concurrently.run_all') as r_mock:
         with patch('concurrently.summarise_tasks',
                    return_value=101) as s_mock:
             returncode = concurrently.main(['-v', '-l', '.'] + definitions)
     self.assertEqual(100, returncode)
     tasks = map(concurrently.Task.from_arg, definitions)
     r_mock.assert_called_once_with(tasks)
     s_mock.assert_called_once_with(tasks)
Exemplo n.º 4
0
 def test_main(self):
     with patch('concurrently.run_all', autospec=True) as r_mock:
         with patch('concurrently.summarise_tasks', autospec=True,
                    return_value=0) as s_mock:
             returncode = concurrently.main(
                 ['-v', '-l', '.', 'one=foo a b', 'two=bar c'])
     self.assertEqual(0, returncode)
     task_one = concurrently.Task.from_arg('one=foo a b')
     task_two = concurrently.Task.from_arg('two=bar c')
     r_mock.assert_called_once_with([task_one, task_two])
     s_mock.assert_called_once_with([task_one, task_two])
Exemplo n.º 5
0
 def test_main(self):
     with patch('concurrently.run_all', autospec=True) as r_mock:
         with patch('concurrently.summarise_tasks',
                    autospec=True,
                    return_value=0) as s_mock:
             returncode = concurrently.main(
                 ['-v', '-l', '.', 'one=foo a b', 'two=bar c'])
     self.assertEqual(0, returncode)
     task_one = concurrently.Task.from_arg('one=foo a b')
     task_two = concurrently.Task.from_arg('two=bar c')
     r_mock.assert_called_once_with([task_one, task_two])
     s_mock.assert_called_once_with([task_one, task_two])
Exemplo n.º 6
0
 def test_bad_task_bad_lex(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'wrong="command'])
     self.assertIn("""invalid task_definition value: 'wrong="command'""",
                   err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
Exemplo n.º 7
0
 def test_bad_task_missing_name(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'bad'])
     self.assertIn("invalid task_definition value: 'bad'",
                   err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
Exemplo n.º 8
0
 def test_main_error(self):
     with patch('concurrently.run_all', side_effect=ValueError('bad')):
         returncode = concurrently.main(['-v', 'one=foo a b', 'two=bar c'])
     self.assertEqual(126, returncode)
     self.assertIn('ERROR Script failed', self.log_stream.getvalue())
     self.assertIn('ValueError: bad', self.log_stream.getvalue())
Exemplo n.º 9
0
 def test_bad_task_missing_name(self):
     with parse_error(self) as err_stream:
         concurrently.main(['-v', 'bad'])
     self.assertIn(
         "invalid task_definition value: 'bad'", err_stream.getvalue())
     self.assertEqual('', self.log_stream.getvalue())
Exemplo n.º 10
0
 def test_main_error(self):
     with patch('concurrently.run_all', side_effect=ValueError('bad')):
         returncode = concurrently.main(['-v', 'one=foo a b', 'two=bar c'])
     self.assertEqual(126, returncode)
     self.assertIn('ERROR Script failed', self.log_stream.getvalue())
     self.assertIn('ValueError: bad', self.log_stream.getvalue())