Skip to content

0.12 cannot use context for state handling #309

@presidento

Description

@presidento
------------------
@ctask
def a(ctx):
    ctx['a'] = 123
    print('a')

@ctask(a)
def b(ctx):
    print(ctx['a'])
    print('b')
------------------
$ > invoke b

Expected result: a 123 b (it works with Invoke 0.11.1)
Actual result: the following exception:

Traceback (most recent call last):
  File "/home/matefarkas/work/bsp-install/bin/inv", line 9, in <module>
    load_entry_point('invoke', 'console_scripts', 'inv')()
  File "/home/matefarkas/work/invoke/invoke/program.py", line 270, in run
    self.execute()
  File "/home/matefarkas/work/invoke/invoke/program.py", line 379, in execute
    executor.execute(*self.tasks)
  File "/home/matefarkas/work/invoke/invoke/executor.py", line 114, in execute
    result = call.task(*args, **call.kwargs)
  File "/home/matefarkas/work/invoke/invoke/tasks.py", line 113, in __call__
    result = self.body(*args, **kwargs)
  File "/home/matefarkas/work/invoke/tasks.py", line 15, in b
    print(ctx['a'])
  File "/home/matefarkas/work/invoke/invoke/config.py", line 110, in __getitem__
    return self._get(key)
  File "/home/matefarkas/work/invoke/invoke/config.py", line 113, in _get
    value = self.config[key]
  File "/home/matefarkas/work/invoke/invoke/config.py", line 110, in __getitem__
    return self._get(key)
  File "/home/matefarkas/work/invoke/invoke/config.py", line 113, in _get
    value = self.config[key]
KeyError: 'a'

As I know, since 0.12 Invoke does not remembers the state changed in pre tasks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions