Summary:
When exit_hook is passed as a list of strings across inherited nodes (Suite to Family), duplicate lines are removed.
This strips user-provided hook content that may intentionally repeat commands.
I don't see why we need to avoid duplication. Maybe @jinmannwong had some use case in mind?
This raise some unintended consequences with scripts passed as lists where boilerplate lines like fi (the markup of the end of a if-else block) gets removed.
Example
from pyflow import Suite, Family, Task
parent_line = "echo duplicate_line"
child_lines = ["echo duplicate_line", "echo post_cleanup"]
with Suite("S", exit_hook=parent_lines):
with Family("f", exit_hook=child_lines) as f:
t1 = Task("t1")
expected = [
"echo pre_cleanup",
"echo duplicate_line",
"echo duplicate_line",
"echo post_cleanup",
]
print("Expected:", expected)
# > Expected: ['echo pre_cleanup', 'echo duplicate_line', 'echo duplicate_line', 'echo post_cleanup']
print("Actual family:", f._exit_hook)
# > Actual family: ['echo duplicate_line', 'echo post_cleanup']
print("Actual task:", t1._exit_hook)
# > Actual task: ['echo duplicate_line', 'echo post_cleanup']
# Fails today because duplicate_line is deduplicated
assert f._exit_hook == expected
assert t1._exit_hook == expected
Summary:
When exit_hook is passed as a list of strings across inherited nodes (Suite to Family), duplicate lines are removed.
This strips user-provided hook content that may intentionally repeat commands.
I don't see why we need to avoid duplication. Maybe @jinmannwong had some use case in mind?
This raise some unintended consequences with scripts passed as lists where boilerplate lines like
fi(the markup of the end of aif-elseblock) gets removed.Example