diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-10-20 18:16:07 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-12-07 14:12:33 +0000 |
commit | 14ef3ba4ff703cfe5b524ac5d191cc0a05517ce1 (patch) | |
tree | e88c8a6df791c9988d942a3318c0d08511832643 /tests/testutils/runcli.py | |
parent | c38208606ea52c9fb160bec51b145f2080af491c (diff) | |
download | buildstream-14ef3ba4ff703cfe5b524ac5d191cc0a05517ce1.tar.gz |
Fix teststracking-changes
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 f165232dc..202766fb3 100644 --- a/tests/testutils/runcli.py +++ b/tests/testutils/runcli.py @@ -1,5 +1,7 @@ import os +import re import sys +import shutil import itertools import traceback from contextlib import contextmanager, ExitStack @@ -7,6 +9,8 @@ from click.testing import CliRunner from ruamel import yaml import pytest +from tests.testutils.site import IS_LINUX + # Import the main cli entrypoint from buildstream._frontend.main import cli as bst_cli from buildstream import _yaml @@ -24,6 +28,17 @@ class Result(): self.exception = _get_last_exception() self.result = result + ################################################################## + # Result parsers # + ################################################################## + def get_tracked_elements(self): + tracked = re.findall(r'\[track:(\S+)\s*]', + self.result.output) + if tracked is None: + return [] + + return list(tracked) + class Cli(): @@ -44,6 +59,17 @@ class Cli(): def configure(self, config): self.config = config + def remove_artifact_from_cache(self, project, element_name): + cache_dir = os.path.join(project, 'cache', 'artifacts') + + if IS_LINUX: + cache_dir = os.path.join(cache_dir, 'ostree', 'refs', 'heads') + else: + cache_dir = os.path.join(cache_dir, 'tar') + + cache_dir = os.path.splitext(os.path.join(cache_dir, 'test', element_name))[0] + shutil.rmtree(cache_dir) + # run(): # # Runs buildstream with the given arguments, additionally |