Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Commit 7e518be

Browse files
committed
#43: Cover with a functional test
1 parent 0596070 commit 7e518be

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

test/test_context.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
from rkd.context import distinct_imports
1010
from rkd.api.inputoutput import NullSystemIO
1111
from rkd.exception import ContextException
12-
from rkd.syntax import TaskDeclaration
13-
from rkd.syntax import TaskAliasDeclaration
12+
from rkd.api.syntax import TaskDeclaration
13+
from rkd.api.syntax import TaskAliasDeclaration
14+
from rkd.api.syntax import GroupDeclaration
1415
from rkd.test import TestTask
16+
from rkd.standardlib import InitTask
1517

1618
CURRENT_SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
1719

@@ -166,3 +168,21 @@ def _common_test_loads_task_from_file(self, path: str, task: str, filename: str)
166168
msg='Expected that %s task would be loaded from %s' % (task, filename))
167169

168170
os.environ['RKD_PATH'] = ''
171+
172+
def test_context_resolves_recursively_task_aliases(self):
173+
ctx = ApplicationContext([
174+
TaskDeclaration(InitTask())
175+
], [
176+
TaskAliasDeclaration(':deeper', [':init', ':init']),
177+
TaskAliasDeclaration(':deep', [':init', ':deeper'])
178+
], directory='')
179+
180+
ctx.compile()
181+
task = ctx.find_task_by_name(':deep')
182+
task: GroupDeclaration
183+
184+
# :deeper = :init
185+
# :deep = :init :deeper = :init :init :init
186+
self.assertEqual(':init', task.get_declarations()[0].to_full_name())
187+
self.assertEqual(':init', task.get_declarations()[1].to_full_name())
188+
self.assertEqual(':init', task.get_declarations()[2].to_full_name())

0 commit comments

Comments
 (0)