def new_process(self, consumer_name): """Create a new consumer instances :param str consumer_name: The name of the consumer :return tuple: (str, process.Process) """ process_name = '%s-%s' % (consumer_name, self.new_process_number(consumer_name)) kwargs = { 'config': self.config.application, 'consumer_name': consumer_name, 'profile': self.profile, 'daemon': False, 'stats_queue': self.stats_queue, 'logging_config': self.config.logging } return process_name, process.Process(name=process_name, kwargs=kwargs)
def new_process(self, kwargs=None): with patch('multiprocessing.Process'): return process.Process(group=None, name='MockProcess', kwargs=kwargs or self.new_kwargs(self.mock_args))