In fabric.main.extract_tasks(), the dict mapping names to new-style task
objects now uses the variable name of the object when the object's name
attribute is not defined. (Technically, when not obj.name or obj.name
This change brings the behavior for mapping tasks to names in compliance
with the fabric documentation.
Subclass Task (Task itself is intended to be abstract), define a run
method, and instantiate your subclass at module level. Instances’
name attributes are used as the task name; if omitted the instance’s
variable name will be used instead.
A test case was added to confirm that the task name equal the variable
name when the task object name attribute is undefined. This test fails
with the old code and passes with the patched code.
New-style Task subclass objects which do not define a name attribute end
up with the default obj.name = 'undefined' from Task. When the tasks
are extracted from a loaded fabfile, obj.name should be set to the name
of the instance variable, since obj.name is used internally by fabric in
some circumstances, e.g. when `execute()` is called. This commit sets
`obj.name = name` for task objects without a name, or with an undefined