Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent PythonAction from modifying task attributes by passing copies #129

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Michael Gliwinski - https://launchpad.net/~tzeentch-gm
* Vadim Fint - mocksoul <at> gmail <dot> com
* Thomas Kluyver - https://bitbucket.org/takluyver
* rbeagrie - https://bitbucket.org/rbeagrie
* Rob Beagrie - http://rob.beagrie.com
* Miguel Angel Garcia - http://magmax.org
* Roland Puntaier - roland <dot> puntaier <at> gmail <dot> com
* Vincent Férotin - vincent <dot> ferotin <at> gmail <dot> com
Expand Down
2 changes: 0 additions & 2 deletions dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from doitpy.package import Package


from doit.tools import create_folder

DOIT_CONFIG = {
'minversion': '0.24.0',
'default_tasks': ['pyflakes', 'ut'],
Expand Down
15 changes: 15 additions & 0 deletions tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,21 @@ def py_callable(pos, *args, kwonly=None, **kwargs):
my_action.execute()
assert [1, (2, 3), 4, 5] == got, repr(got)

def test_action_modifies_task_attributes(self, task_depchanged):
def py_callable(targets, dependencies, changed, task):
targets.append('new_target')
dependencies.append('new_dependency')
changed.append('new_changed')
my_action = action.PythonAction(py_callable, task=task_depchanged)
my_action.execute()

assert task_depchanged.file_dep == ['dependencies', 'new_dependency']

assert task_depchanged.targets == ['targets', 'new_target']

assert task_depchanged.dep_changed == ['changed', 'new_changed']


##############


Expand Down