summaryrefslogtreecommitdiff
path: root/tests/sources/git.py
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-02-28 18:47:20 +0000
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-02-28 18:47:20 +0000
commit6d4a4e9928bb718d2da446a7d6a11708301625f2 (patch)
treec4b25b736e26409a5d3eb3222d54fb1c7e445f0a /tests/sources/git.py
parent348f04e7a80338de1b9cc911e48263d8cd31be65 (diff)
downloadbuildstream-bschubert/fix-test-paths.tar.gz
store full host tools command in sites.py variables check.bschubert/fix-test-paths
This allows tests importing them to have access to the commands directly and removes the need from calling this multiple times This also fixes multiple bugs where the paths of the tests runners might not be canonical and tools would not get found correctly
Diffstat (limited to 'tests/sources/git.py')
-rw-r--r--tests/sources/git.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/tests/sources/git.py b/tests/sources/git.py
index f3d2e2809..e18db387b 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -30,9 +30,9 @@ from buildstream import _yaml
from buildstream.plugin import CoreWarnings
from buildstream.plugintestutils import cli
-from tests.testutils.site import HAVE_GIT, HAVE_OLD_GIT
+from tests.testutils.site import GIT, HAVE_OLD_GIT
from tests.testutils import create_repo
-from tests.testutils.site import HAVE_GIT, HAVE_OLD_GIT
+from tests.testutils.site import GIT, HAVE_OLD_GIT
DATA_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
@@ -40,7 +40,7 @@ DATA_DIR = os.path.join(
)
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_fetch_bad_ref(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -66,7 +66,7 @@ def test_fetch_bad_ref(cli, tmpdir, datafiles):
result.assert_task_error(ErrorDomain.SOURCE, None)
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_fetch_checkout(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -105,7 +105,7 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles):
assert os.path.exists(os.path.join(checkoutdir, 'subdir', 'ponyfile.txt'))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -144,7 +144,7 @@ def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles):
assert os.path.exists(os.path.join(checkoutdir, 'subdir', 'ponyfile.txt'))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_fetch_source_disable(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -183,7 +183,7 @@ def test_submodule_fetch_source_disable(cli, tmpdir, datafiles):
assert not os.path.exists(os.path.join(checkoutdir, 'subdir', 'ponyfile.txt'))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -222,7 +222,7 @@ def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles):
assert os.path.exists(os.path.join(checkoutdir, 'subdir', 'ponyfile.txt'))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -267,7 +267,7 @@ def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles):
assert os.path.exists(os.path.join(checkoutdir, 'othersubdir', 'unicornfile.txt'))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -312,7 +312,7 @@ def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, dat
assert os.path.exists(os.path.join(checkoutdir, 'othersubdir', 'unicornfile.txt'))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'project-override'))
def test_submodule_fetch_project_override(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -351,7 +351,7 @@ def test_submodule_fetch_project_override(cli, tmpdir, datafiles):
assert not os.path.exists(os.path.join(checkoutdir, 'subdir', 'ponyfile.txt'))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_track_ignore_inconsistent(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -388,7 +388,7 @@ def test_submodule_track_ignore_inconsistent(cli, tmpdir, datafiles):
assert "Ignoring inconsistent submodule" in result.stderr
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
@@ -415,7 +415,7 @@ def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles):
result.assert_task_error(None, None)
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("fail", ['warn', 'error'])
def test_ref_not_in_track(cli, tmpdir, datafiles, fail):
@@ -458,7 +458,7 @@ def test_ref_not_in_track(cli, tmpdir, datafiles, fail):
assert "ref-not-in-track" in result.stderr
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("fail", ['warn', 'error'])
def test_unlisted_submodule(cli, tmpdir, datafiles, fail):
@@ -531,7 +531,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail):
assert "git:unlisted-submodule" in result.stderr
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("fail", ['warn', 'error'])
def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail):
@@ -594,7 +594,7 @@ def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail):
assert "git:unlisted-submodule" in result.stderr
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("fail", ['warn', 'error'])
def test_invalid_submodule(cli, tmpdir, datafiles, fail):
@@ -665,7 +665,7 @@ def test_invalid_submodule(cli, tmpdir, datafiles, fail):
assert "git:invalid-submodule" in result.stderr
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.skipif(HAVE_OLD_GIT, reason="old git rm does not update .gitmodules")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("fail", ['warn', 'error'])
@@ -727,7 +727,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail):
assert "git:invalid-submodule" in result.stderr
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("ref_format", ['sha1', 'git-describe'])
@pytest.mark.parametrize("tag,extra_commit", [(False, False), (True, False), (True, True)])
@@ -774,7 +774,7 @@ def test_track_fetch(cli, tmpdir, datafiles, ref_format, tag, extra_commit):
result.assert_success()
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.skipif(HAVE_OLD_GIT, reason="old git describe lacks --first-parent")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
@@ -887,7 +887,7 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
assert p.returncode != 0
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
@pytest.mark.parametrize("tag_type", [('annotated'), ('lightweight')])
@@ -998,7 +998,7 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty
assert p.returncode != 0
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_git_describe_relevant_history(cli, tmpdir, datafiles):
project = str(datafiles)
@@ -1076,7 +1076,7 @@ def test_git_describe_relevant_history(cli, tmpdir, datafiles):
assert set(rev_list.splitlines()) == set([head, tagged_ref, branch_boundary])
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_default_do_not_track_tags(cli, tmpdir, datafiles):
project = str(datafiles)
@@ -1116,7 +1116,7 @@ def test_default_do_not_track_tags(cli, tmpdir, datafiles):
assert 'tags' not in element['sources'][0]
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+@pytest.mark.skipif(GIT is None, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
def test_overwrite_rogue_tag_multiple_remotes(cli, tmpdir, datafiles):
"""When using multiple remotes in cache (i.e. when using aliases), we