Esempio n. 1
0
 def test_start_can_block_until_sigint_received(self, pause_mock,
                                                signal_mock,
                                                plugin_manager_mock):
     octo.run(plugin_dirs=[], block=True)
     signal_mock.assert_called_with(signal.SIGINT,
                                    octo.manager.exit_handler)
     self.assertTrue(pause_mock.called)
Esempio n. 2
0
 def test_start_initializes_manager_stop_resets_instance(
         self, plugin_manager_mock):
     self.assertEqual(octo.instance, None)
     octo.run(plugin_dirs=[])
     self.assertTrue(isinstance(octo.instance, octo.Manager))
     octo.stop()
     self.assertEqual(octo.instance, None)
Esempio n. 3
0
File: cli.py Progetto: zoni/octo
def main():
	"""
	Main entry point for octo CLI script.

	Normally, setuptools packaging will create a script which uses this function
	as it's entry point. (See entry_points in setup.py).
	"""
	parser = argparse.ArgumentParser()
	parser.add_argument('-l', '--log-level',
	                    help="Log level to use. Valid values are NONE, "
	                         "DEBUG, INFO, WARNING, ERROR and CRITICAL",
	                    default="INFO")
	parser.add_argument('plugin_dirs',
	                    metavar='plugin-directory',
	                    help="Directory from which to load plugins",
	                    nargs='+')
	args = parser.parse_args()

	log_level = args.log_level.upper()
	if log_level != "NONE":
		logging.basicConfig(level=getattr(logging, log_level))

	octo.run(plugin_dirs=args.plugin_dirs, block=True)
Esempio n. 4
0
def main():
    """
	Main entry point for octo CLI script.

	Normally, setuptools packaging will create a script which uses this function
	as it's entry point. (See entry_points in setup.py).
	"""
    parser = argparse.ArgumentParser()
    parser.add_argument('-l',
                        '--log-level',
                        help="Log level to use. Valid values are NONE, "
                        "DEBUG, INFO, WARNING, ERROR and CRITICAL",
                        default="INFO")
    parser.add_argument('plugin_dirs',
                        metavar='plugin-directory',
                        help="Directory from which to load plugins",
                        nargs='+')
    args = parser.parse_args()

    log_level = args.log_level.upper()
    if log_level != "NONE":
        logging.basicConfig(level=getattr(logging, log_level))

    octo.run(plugin_dirs=args.plugin_dirs, block=True)
Esempio n. 5
0
	def test_stop_raises_exception_when_called_twice(self, plugin_manager_mock):
		octo.run(plugin_dirs=[])
		octo.stop()
		octo.stop()
Esempio n. 6
0
	def test_start_and_stop_sequence_with_plugins(self, plugin_manager_mock):
		octo.run(plugin_dirs=[PLUGIN_DIR])
		octo.stop()
Esempio n. 7
0
	def test_stop_deletes_manager(self, plugin_manager_mock):
		octo.run(plugin_dirs=[])
		self.assertTrue(isinstance(octo.instance, octo.Manager))
		octo.stop()
		self.assertEqual(octo.instance, None)
Esempio n. 8
0
	def test_start_can_block_until_sigint_received(self, pause_mock, signal_mock, plugin_manager_mock):
		octo.run(plugin_dirs=[], block=True)
		signal_mock.assert_called_with(signal.SIGINT, octo.manager.exit_handler)
		self.assertTrue(pause_mock.called)
Esempio n. 9
0
	def test_stop_calls_instance_stop(self, plugin_manager_mock):
		octo.run(plugin_dirs=[])
		with patch.object(octo, 'instance') as mock_method:
			octo.stop()
		self.assertTrue(mock_method.stop.called)
Esempio n. 10
0
	def test_start_calls_instance_start(self, plugin_manager_mock):
		with patch.object(octo.manager, 'Manager') as mock_method:
			octo.run(plugin_dirs=[])
		self.assertEqual(mock_method.mock_calls, [call(plugin_dirs=[]), call().start()])
Esempio n. 11
0
	def test_start_initializes_manager_stop_resets_instance(self, plugin_manager_mock):
		self.assertEqual(octo.instance, None)
		octo.run(plugin_dirs=[])
		self.assertTrue(isinstance(octo.instance, octo.Manager))
		octo.stop()
		self.assertEqual(octo.instance, None)
Esempio n. 12
0
 def test_stop_raises_exception_when_called_twice(self,
                                                  plugin_manager_mock):
     octo.run(plugin_dirs=[])
     octo.stop()
     octo.stop()
Esempio n. 13
0
 def test_start_and_stop_sequence_with_plugins(self, plugin_manager_mock):
     octo.run(plugin_dirs=[PLUGIN_DIR])
     octo.stop()
Esempio n. 14
0
 def test_stop_deletes_manager(self, plugin_manager_mock):
     octo.run(plugin_dirs=[])
     self.assertTrue(isinstance(octo.instance, octo.Manager))
     octo.stop()
     self.assertEqual(octo.instance, None)
Esempio n. 15
0
 def test_stop_calls_instance_stop(self, plugin_manager_mock):
     octo.run(plugin_dirs=[])
     with patch.object(octo, 'instance') as mock_method:
         octo.stop()
     self.assertTrue(mock_method.stop.called)
Esempio n. 16
0
 def test_start_calls_instance_start(self, plugin_manager_mock):
     with patch.object(octo.manager, 'Manager') as mock_method:
         octo.run(plugin_dirs=[])
     self.assertEqual(
         mock_method.mock_calls,
         [call(plugin_dirs=[]), call().start()])