MCPcopy Index your code
hub / github.com/pyinvoke/invoke / setup_method

Method setup_method

tests/collection.py:451–470  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

449
450 class to_contexts:
451 def setup_method(self):
452 @task
453 def mytask(c, text, boolean=False, number=5):
454 print(text)
455
456 @task(aliases=["mytask27"])
457 def mytask2(c):
458 pass
459
460 @task(aliases=["othertask"], default=True)
461 def subtask(c):
462 pass
463
464 sub = Collection("sub", subtask)
465 self.c = Collection(mytask, mytask2, sub)
466 self.contexts = self.c.to_contexts()
467 alias_tups = [list(x.aliases) for x in self.contexts]
468 self.aliases = reduce(operator.add, alias_tups, [])
469 # Focus on 'mytask' as it has the more interesting sig
470 self.context = [x for x in self.contexts if x.name == "mytask"][0]
471
472 def returns_iterable_of_Contexts_corresponding_to_tasks(self):
473 assert self.context.name == "mytask"

Callers

nothing calls this directly

Calls 2

CollectionClass · 0.90
to_contextsMethod · 0.80

Tested by

no test coverage detected