close
Skip to content

Support kw=Collection(task) in addition to Collection('kw', task) #528

@tuukkamustonen

Description

@tuukkamustonen

Pre-0.23 supported:

ns = Collection(
    env=Collection(some_task1, some_task2),
)

But now it fails (on py3.5 at least) to:

Traceback (most recent call last):
  File "/home/musttu/.pyenv/versions/his/bin/inv", line 11, in <module>
    sys.exit(program.run())
  File "/home/musttu/.pyenv/versions/3.5.5/envs/his/lib/python3.5/site-packages/invoke/program.py", line 325, in run
    self.parse_cleanup()
  File "/home/musttu/.pyenv/versions/3.5.5/envs/his/lib/python3.5/site-packages/invoke/program.py", line 450, in parse_cleanup
    self.list_tasks()
  File "/home/musttu/.pyenv/versions/3.5.5/envs/his/lib/python3.5/site-packages/invoke/program.py", line 665, in list_tasks
    getattr(self, "list_{}".format(self.list_format))()
  File "/home/musttu/.pyenv/versions/3.5.5/envs/his/lib/python3.5/site-packages/invoke/program.py", line 668, in list_flat
    pairs = self._make_pairs(self.scoped_collection, ancestors=[])
  File "/home/musttu/.pyenv/versions/3.5.5/envs/his/lib/python3.5/site-packages/invoke/program.py", line 739, in _make_pairs
    recursed_pairs = self._make_pairs(subcoll, ancestors + [coll])
  File "/home/musttu/.pyenv/versions/3.5.5/envs/his/lib/python3.5/site-packages/invoke/program.py", line 685, in _make_pairs
    ancestor_path = '.'.join(x.name for x in display_ancestors)
TypeError: sequence item 0: expected str instance, NoneType found

Now we have to give the namespace as str parameter to Collection as in:

ns = Collection(
    Collection('env', some_task1, some_task2),
)

Was this change intended or accidental? I liked to old way more (rather kwarg than positional string arg).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions