def setup(self): TaskConfig = namedtuple('TaskConfig', 'cmd task_id cpus mem disk env') self.action_run_id = 'my_service.job.1.action' self.task_id = '123abcuuid' with mock.patch('tron.mesos.logging.getLogger', return_value=mock.Mock(handlers=[mock.Mock()]), autospec=None): self.task = MesosTask( id=self.action_run_id, task_config=TaskConfig(cmd='echo hello world', task_id=self.task_id, cpus=0.1, mem=100, disk=100, env={ 'INITIAL_VAR': 'baz', 'AWS_SECRET_ACCESS_KEY': 'THISISASECRET', 'SOME_VAR': 'bar', 'AWS_ACCESS_KEY_ID': 'THISISASECRETTOO', 'SOME_OTHER_VAR': 'foo', }), ) yield
def setup(self): self.action_run_id = 'my_service.job.1.action' self.task_id = '123abcuuid' self.task = MesosTask( id=self.action_run_id, task_config=mock.Mock( cmd='echo hello world', task_id=self.task_id, ), ) # Suppress logging with mock.patch.object(self.task, 'log'): yield