summaryrefslogtreecommitdiff
path: root/tests/testutils
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-31 12:13:26 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-06-06 14:33:59 +0000
commit09b0cf8a208c46440cdb4d59ef1388522f12857a (patch)
tree6dab6c64ac15465d20ef45a6ee3c562fc6e0baf9 /tests/testutils
parent3660337905dada5ee6bd9419ff83b5a6819f6801 (diff)
downloadbuildstream-09b0cf8a208c46440cdb4d59ef1388522f12857a.tar.gz
test:utils/site: Consolidate Git environment variables in a single place
We have two different 'site' files that are redundant and both define some variables in BuildStream environment. Moving all the git related ones in a single place.
Diffstat (limited to 'tests/testutils')
-rw-r--r--tests/testutils/repo/git.py16
-rw-r--r--tests/testutils/site.py11
2 files changed, 3 insertions, 24 deletions
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py
index 8ffd09c2f..f4e300b53 100644
--- a/tests/testutils/repo/git.py
+++ b/tests/testutils/repo/git.py
@@ -5,23 +5,13 @@ import subprocess
import pytest
from buildstream.testing import Repo
-from .. import site
-
-
-GIT_ENV = {
- 'GIT_AUTHOR_DATE': '1320966000 +0200',
- 'GIT_AUTHOR_NAME': 'tomjon',
- 'GIT_AUTHOR_EMAIL': 'tom@jon.com',
- 'GIT_COMMITTER_DATE': '1320966000 +0200',
- 'GIT_COMMITTER_NAME': 'tomjon',
- 'GIT_COMMITTER_EMAIL': 'tom@jon.com'
-}
+from buildstream.testing._utils.site import GIT, GIT_ENV, HAVE_GIT
class Git(Repo):
def __init__(self, directory, subdir):
- if not site.HAVE_GIT:
+ if not HAVE_GIT:
pytest.skip("git is not available")
self.submodules = {}
@@ -29,7 +19,7 @@ class Git(Repo):
super(Git, self).__init__(directory, subdir)
def _run_git(self, *args, **kwargs):
- argv = [site.GIT]
+ argv = [GIT]
argv.extend(args)
if 'env' not in kwargs:
kwargs['env'] = dict(GIT_ENV, PWD=self.repo)
diff --git a/tests/testutils/site.py b/tests/testutils/site.py
index a7ff415e3..6801ee066 100644
--- a/tests/testutils/site.py
+++ b/tests/testutils/site.py
@@ -2,7 +2,6 @@
# so we dont have to repeat this everywhere
#
import os
-import subprocess
import sys
import platform
@@ -11,16 +10,6 @@ from buildstream._platform import Platform
try:
- 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('.'))
- HAVE_OLD_GIT = version < (1, 8, 5)
-except ProgramNotFoundError:
- HAVE_GIT = False
- HAVE_OLD_GIT = False
-
-try:
OSTREE_CLI = utils.get_host_tool('ostree')
HAVE_OSTREE_CLI = True
except ProgramNotFoundError: