diff options
author | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 10:41:07 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-03-01 10:41:07 +0000 |
commit | 57a314d8793b64859598c2217208e2d1d83af5b5 (patch) | |
tree | 8ca50855703b9f55eb6d25cf3288f4178289ae75 | |
parent | fc2b42d63ac4ec1bc7727a1f7705613305060572 (diff) | |
parent | 99e37b6df848257d46fa60ccaf699cf95922049a (diff) | |
download | buildstream-57a314d8793b64859598c2217208e2d1d83af5b5.tar.gz |
Merge branch 'bschubert/fix-test-paths' into 'master'
store full host tools command in sites.py variables check.
Closes #936
See merge request BuildStream/buildstream!1194
-rw-r--r-- | tests/testutils/repo/bzr.py | 8 | ||||
-rw-r--r-- | tests/testutils/repo/git.py | 11 | ||||
-rw-r--r-- | tests/testutils/repo/ostree.py | 11 | ||||
-rw-r--r-- | tests/testutils/site.py | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/tests/testutils/repo/bzr.py b/tests/testutils/repo/bzr.py index e8abdfee0..e159fa052 100644 --- a/tests/testutils/repo/bzr.py +++ b/tests/testutils/repo/bzr.py @@ -2,9 +2,9 @@ import os import subprocess import pytest -from buildstream import utils from .repo import Repo -from ..site import HAVE_BZR +from .. import site + BZR_ENV = { "BZR_EMAIL": "Testy McTesterson <testy.mctesterson@example.com>" @@ -14,10 +14,10 @@ BZR_ENV = { class Bzr(Repo): def __init__(self, directory, subdir): - if not HAVE_BZR: + if not site.HAVE_BZR: pytest.skip("bzr is not available") super(Bzr, self).__init__(directory, subdir) - self.bzr = utils.get_host_tool('bzr') + self.bzr = site.BZR def create(self, directory): branch_dir = os.path.join(self.repo, 'trunk') diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py index 3eb8c6577..9f617a763 100644 --- a/tests/testutils/repo/git.py +++ b/tests/testutils/repo/git.py @@ -4,7 +4,8 @@ import shutil import subprocess from .repo import Repo -from ..site import HAVE_GIT +from .. import site + GIT_ENV = { 'GIT_AUTHOR_DATE': '1320966000 +0200', @@ -19,7 +20,7 @@ GIT_ENV = { class Git(Repo): def __init__(self, directory, subdir): - if not HAVE_GIT: + if not site.HAVE_GIT: pytest.skip("git is not available") self.submodules = {} @@ -27,7 +28,7 @@ class Git(Repo): super(Git, self).__init__(directory, subdir) def _run_git(self, *args, **kwargs): - argv = ['git'] + argv = [site.GIT] argv.extend(args) if 'env' not in kwargs: kwargs['env'] = dict(GIT_ENV, PWD=self.repo) @@ -60,9 +61,7 @@ class Git(Repo): def modify_file(self, new_file, path): shutil.copy(new_file, os.path.join(self.repo, path)) - subprocess.call([ - 'git', 'commit', path, '-m', 'Modified {}'.format(os.path.basename(path)) - ], env=GIT_ENV, cwd=self.repo) + self._run_git('commit', path, '-m', 'Modified {}'.format(os.path.basename(path))) return self.latest_commit() def add_submodule(self, subdir, url=None, checkout=None): diff --git a/tests/testutils/repo/ostree.py b/tests/testutils/repo/ostree.py index e240de113..1cd7c8979 100644 --- a/tests/testutils/repo/ostree.py +++ b/tests/testutils/repo/ostree.py @@ -2,22 +2,23 @@ import pytest import subprocess from .repo import Repo -from ..site import HAVE_OSTREE_CLI, HAVE_OSTREE +from .. import site class OSTree(Repo): def __init__(self, directory, subdir): - if not HAVE_OSTREE_CLI or not HAVE_OSTREE: + if not site.HAVE_OSTREE_CLI or not site.HAVE_OSTREE: pytest.skip("ostree cli is not available") super(OSTree, self).__init__(directory, subdir) + self.ostree = site.OSTREE_CLI def create(self, directory): - subprocess.call(['ostree', 'init', + subprocess.call([self.ostree, 'init', '--repo', self.repo, '--mode', 'archive-z2']) - subprocess.call(['ostree', 'commit', + subprocess.call([self.ostree, 'commit', '--repo', self.repo, '--branch', 'master', '--subject', 'Initial commit', @@ -40,7 +41,7 @@ class OSTree(Repo): def latest_commit(self): output = subprocess.check_output([ - 'ostree', 'rev-parse', + self.ostree, 'rev-parse', '--repo', self.repo, 'master' ]) diff --git a/tests/testutils/site.py b/tests/testutils/site.py index 952b2618c..2f4143407 100644 --- a/tests/testutils/site.py +++ b/tests/testutils/site.py @@ -10,13 +10,13 @@ from buildstream import _site, utils, ProgramNotFoundError from buildstream._platform import Platform try: - utils.get_host_tool('bzr') + BZR = utils.get_host_tool('bzr') HAVE_BZR = True except ProgramNotFoundError: HAVE_BZR = False try: - utils.get_host_tool('git') + GIT = utils.get_host_tool('git') HAVE_GIT = True out = str(subprocess.check_output(['git', '--version']), "utf-8") version = tuple(int(x) for x in out.split(' ')[2].split('.')) @@ -26,7 +26,7 @@ except ProgramNotFoundError: HAVE_OLD_GIT = False try: - utils.get_host_tool('ostree') + OSTREE_CLI = utils.get_host_tool('ostree') HAVE_OSTREE_CLI = True except ProgramNotFoundError: HAVE_OSTREE_CLI = False |