|
9 | 9 | from rkd.context import distinct_imports
|
10 | 10 | from rkd.api.inputoutput import NullSystemIO
|
11 | 11 | 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 |
14 | 15 | from rkd.test import TestTask
|
| 16 | +from rkd.standardlib import InitTask |
15 | 17 |
|
16 | 18 | CURRENT_SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
|
17 | 19 |
|
@@ -166,3 +168,21 @@ def _common_test_loads_task_from_file(self, path: str, task: str, filename: str)
|
166 | 168 | msg='Expected that %s task would be loaded from %s' % (task, filename))
|
167 | 169 |
|
168 | 170 | 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