Example #1
0
    def _schedule_calls(self, executor, calls):
        def make_wrapper(fn, name):
            def _wrapper(*args, **kwargs):
                logger.info('Starting {task}'.format(task=name))
                fn(*args, **kwargs)

            return _wrapper

        futures = []
        for call in calls:
            # The Invoke config object is *not* thread safe in any way.
            # Make sure to make a copy of it before proceeding with parallel execution.
            config = copy.deepcopy(self.config)
            collection_config = self.collection.configuration(call.called_as)
            config.load_collection(collection_config)
            config.load_shell_env()
            config.core = self.core[0]
            config.build_dir = BuildDir(config.core.args['build-dir'].value)
            context = call.make_context(config)
            args = (context, ) + call.args
            future = executor.submit(make_wrapper(call.task, call.name), *args,
                                     **call.kwargs)
            future.call = call
            futures.append(future)
        return futures
Example #2
0
 def _get_mock_context(self):
     ctx = Mock()
     ctx.build_dir = BuildDir()
     ctx.znake.deb.package = 'my_package'
     ctx.znake.info.maintainer = 'nfsguy87'
     ctx.znake.info.maintainer_email = '*****@*****.**'
     return ctx
Example #3
0
 def _get_mock_context(self):
     ctx = Mock()
     ctx.build_dir = BuildDir()
     ctx.znake.deb.package = 'my_package'
     ctx.znake.info.maintainer = 'intercalguy83'
     ctx.znake.info.maintainer_email = '*****@*****.**'
     ctx.znake.info.short_description = 'this is my short description'
     ctx.znake.info.long_description = 'this is my long description please'
     return ctx
Example #4
0
 def _get_mock_config(self):
     config = Mock()
     config.build_dir = BuildDir()
     config.znake.test.targets = []
     config.znake.systest.targets = []
     return config
Example #5
0
 def _get_mock_config(self):
     config = Mock()
     config.build_dir = BuildDir()
     return config
Example #6
0
 def _get_mock_context(self):
     ctx = Mock()
     ctx.build_dir = BuildDir()
     return ctx
Example #7
0
 def _get_mock_config(self):
     config = Mock()
     config.build_dir = BuildDir()
     config.znake.index_url = 'https://pypi.org/simple'
     return config