Exemple #1
0
 def __call__(self, *args, _pype_fixtures=None, **kwargs):
     fixtures = MapProxy({**(_pype_fixtures or {}), **self._wrap_fixtures,
                          **self._partials})
     out = self.task.run(*args, **kwargs, _fixtures=fixtures,
                         _callbacks=self._callbacks)
     if out is None:
         raise TaskReturnedNone
     return args_kwargs(out, adapter=self.adapter)
Exemple #2
0
def _fan(wrap: Wrap,
         inputs,
         _meta,
         que,
         sending_wrap=None,
         used_functions=None):
    """ fan out the output of sending task """
    for val in reversed(de_args_kwargs(*inputs)):
        wrap._queue_up(args_kwargs(val),
                       _meta,
                       que,
                       sending_wrap,
                       used_functions={_fan})
Exemple #3
0
 def _run_aggregations(self, _meta, que):
     """ run aggregated values """
     # collect aggregated things and run queue again
     for wrap_ in _meta["object_scope_map"]:
         # dont run again if object scope is finished
         if wrap_ in _meta["object_scope_finished"]:
             continue
         _meta["object_scope_finished"].add(wrap_)  # mark as complete
         needed_task = _meta["object_scope_map"][wrap_]
         inputs = _meta["object_aggregates"][needed_task]
         if len(inputs):
             que.append((wrap_, args_kwargs(inputs)))
     if len(que):  # if there is anything on the queue run it again
         self._run_queue(_meta, que)
Exemple #4
0
    def __call__(self, *args, _pype_fixtures=None, **kwargs):
        fixtures = MapProxy({
            **(_pype_fixtures or EMPTY_PYPE_FIXTURES),
            **self._wrap_fixtures,
            **self._partials,
        })

        out = self.task.run(
            *args,
            **kwargs,
            _fixtures=fixtures,
            _callbacks=self._callbacks,
            _predicate=self._predicates,
        )
        if out is None:
            raise TaskReturnedNone
        return args_kwargs(out, adapter=self.adapter)
Exemple #5
0
 def test_bad_pairs(self, output, adapt):
     """ test that the bad pairs raise """
     with pytest.raises(AssertionError):
         args_kwargs(output, adapter=adapt)
Exemple #6
0
 def test_good_pairs(self, output, adapt, args, kwargs):
     """ ensure args_kwargs returns correct output """
     assert args_kwargs(output, adapter=adapt) == (args, kwargs)