diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-05-31 10:28:31 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-06-06 14:33:59 +0000 |
commit | 3660337905dada5ee6bd9419ff83b5a6819f6801 (patch) | |
tree | 83c1b1d6bad61138a660a6b3a6b501cdbe1c2648 | |
parent | 17da93ab01cf538fc855492b621916eb32bbf77d (diff) | |
download | buildstream-3660337905dada5ee6bd9419ff83b5a6819f6801.tar.gz |
test:utils/site: Consolidate Bzr environment variables in a single place
We have two different 'site' files that are redundant and both define
some variables in BuildStream environment.
This is a first step in consolidating them in a single file
-rw-r--r-- | src/buildstream/testing/_utils/site.py | 10 | ||||
-rw-r--r-- | tests/cachekey/cachekey.py | 3 | ||||
-rw-r--r-- | tests/sources/bzr.py | 2 | ||||
-rw-r--r-- | tests/testutils/repo/bzr.py | 11 | ||||
-rw-r--r-- | tests/testutils/site.py | 5 |
5 files changed, 16 insertions, 15 deletions
diff --git a/src/buildstream/testing/_utils/site.py b/src/buildstream/testing/_utils/site.py index 54c5b467b..63689301e 100644 --- a/src/buildstream/testing/_utils/site.py +++ b/src/buildstream/testing/_utils/site.py @@ -25,6 +25,16 @@ except ProgramNotFoundError: GIT_ENV = dict() try: + BZR = utils.get_host_tool('bzr') + HAVE_BZR = True + BZR_ENV = { + "BZR_EMAIL": "Testy McTesterson <testy.mctesterson@example.com>" + } +except ProgramNotFoundError: + HAVE_BZR = False + BZR_ENV = {} + +try: utils.get_host_tool('bwrap') HAVE_BWRAP = True HAVE_BWRAP_JSON_STATUS = _site.get_bwrap_version() >= (0, 3, 2) diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py index 2e8c29805..e34c9ff04 100644 --- a/tests/cachekey/cachekey.py +++ b/tests/cachekey/cachekey.py @@ -45,9 +45,10 @@ import os import pytest from buildstream.testing.runcli import cli # pylint: disable=unused-import +from buildstream.testing._utils.site import HAVE_BZR from buildstream.plugin import CoreWarnings from buildstream import _yaml -from tests.testutils.site import HAVE_BZR, HAVE_GIT, IS_LINUX, MACHINE_ARCH +from tests.testutils.site import HAVE_GIT, IS_LINUX, MACHINE_ARCH ############################################## diff --git a/tests/sources/bzr.py b/tests/sources/bzr.py index a11932a49..4a66d89b3 100644 --- a/tests/sources/bzr.py +++ b/tests/sources/bzr.py @@ -8,7 +8,7 @@ from buildstream import _yaml from buildstream.testing import cli # pylint: disable=unused-import from buildstream.testing import create_repo -from tests.testutils.site import HAVE_BZR +from buildstream.testing._utils.site import HAVE_BZR DATA_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), diff --git a/tests/testutils/repo/bzr.py b/tests/testutils/repo/bzr.py index 53bacad17..8b2f17844 100644 --- a/tests/testutils/repo/bzr.py +++ b/tests/testutils/repo/bzr.py @@ -3,21 +3,16 @@ import subprocess import pytest from buildstream.testing import Repo -from .. import site - - -BZR_ENV = { - "BZR_EMAIL": "Testy McTesterson <testy.mctesterson@example.com>" -} +from buildstream.testing._utils.site import BZR, BZR_ENV, HAVE_BZR class Bzr(Repo): def __init__(self, directory, subdir): - if not site.HAVE_BZR: + if not HAVE_BZR: pytest.skip("bzr is not available") super(Bzr, self).__init__(directory, subdir) - self.bzr = site.BZR + self.bzr = BZR def create(self, directory): branch_dir = os.path.join(self.repo, 'trunk') diff --git a/tests/testutils/site.py b/tests/testutils/site.py index ef315efd6..a7ff415e3 100644 --- a/tests/testutils/site.py +++ b/tests/testutils/site.py @@ -9,11 +9,6 @@ import platform from buildstream import _site, utils, ProgramNotFoundError from buildstream._platform import Platform -try: - BZR = utils.get_host_tool('bzr') - HAVE_BZR = True -except ProgramNotFoundError: - HAVE_BZR = False try: GIT = utils.get_host_tool('git') |