Skip to content

Error on passing task to other task #376

@Lense

Description

@Lense
from invoke import task

@task
def preTask(ctx):
    print("preTask")

@task
def testTask(ctx, otherTask=preTask):
    print("otherTask @ ", otherTask)

spits out

Traceback (most recent call last):
  File "/usr/bin/inv", line 11, in <module>
    sys.exit(program.run())
  File "/usr/lib/python2.7/site-packages/invoke/program.py", line 269, in run
    self._parse(argv)
  File "/usr/lib/python2.7/site-packages/invoke/program.py", line 329, in _parse
    self.parse_tasks()
  File "/usr/lib/python2.7/site-packages/invoke/program.py", line 490, in parse_tasks
    self.parser = Parser(contexts=self.collection.to_contexts())
  File "/usr/lib/python2.7/site-packages/invoke/collection.py", line 325, in to_contexts
    name=primary, aliases=aliases, args=task.get_arguments()
  File "/usr/lib/python2.7/site-packages/invoke/tasks.py", line 205, in get_arguments
    new_arg = Argument(**self.arg_opts(name, default, taken_names))
  File "/usr/lib/python2.7/site-packages/invoke/tasks.py", line 180, in arg_opts
    if default not in (None, NO_DEFAULT):
  File "/usr/lib/python2.7/site-packages/invoke/tasks.py", line 83, in __eq__
    if self.name != other.name:
AttributeError: 'NoneType' object has no attribute 'name'

I was originally doing something really dumb because I didn't understand how invoke worked, but I came across this weird case. Feel free to close this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions