Ejemplo n.º 1
0
	def test_get_pid_should_return_none_when_pid_is_self(self):
		self.mock_pid_file(file_pid=str(os.getpid()))
		self.assertEqual(None, proctl.get_running_pid())
Ejemplo n.º 2
0
	def test_get_pid_when_pid_is_valid_and_running(self):
		self.mock_pid_file(file_pid='1234\n', command_response=(0,'1234'))
		self.assertEqual(1234, proctl.get_running_pid())
		self.assertEqual(commands.getstatusoutput.call_args, (("ps ux | grep -v grep | grep 'python.*GRiS' | awk '{print $2}'",),{}))
Ejemplo n.º 3
0
	def test_get_pid_should_return_none_when_pid_is_not_gris(self):
		self.mock_pid_file(file_pid='1234', command_response=(0,'3456'))
		self.assertEqual(None, proctl.get_running_pid())
Ejemplo n.º 4
0
	def test_get_pid_when_file_is_an_integer_with_whitespace(self):
		self.mock_pid_file(file_pid = ' 1234 \n', command_response=(0,'1234'))
		self.assertEqual(1234, proctl.get_running_pid())