diff options
Diffstat (limited to 'tests/testutils/runcli.py')
-rw-r--r-- | tests/testutils/runcli.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py index 0336d8fd5..7cd98ee2e 100644 --- a/tests/testutils/runcli.py +++ b/tests/testutils/runcli.py @@ -1,8 +1,10 @@ import os import sys +import itertools import traceback from contextlib import contextmanager, ExitStack from click.testing import CliRunner +from ruamel import yaml import pytest # Import the main cli entrypoint @@ -131,6 +133,30 @@ class Cli(): assert result.exit_code == 0 return result.output.strip() + # Get the decoded config of an element. + # + def get_element_config(self, project, element_name): + result = self.run(project=project, silent=True, args=[ + 'show', + '--deps', 'none', + '--format', '%{config}', + element_name + ]) + + assert result.exit_code == 0 + return yaml.safe_load(result.output) + + # Fetch the elements that would be in the pipeline with the given + # arguments. + # + def get_pipeline(self, project, elements, except_=[], scope='plan'): + args = ['show', '--deps', scope, '--format', '%{name}'] + args += list(itertools.chain.from_iterable(zip(itertools.repeat('--except'), except_))) + + result = self.run(project=project, silent=True, args=args + elements) + assert result.exit_code == 0 + return result.output.splitlines() + # Main fixture # |