summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-04 11:48:08 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-04 11:49:07 -0400
commitce4bebc13a17e761dc21078b786677a00dae407b (patch)
tree157a48bf3a85dd5c206a19fc6964dd05f128ab67
parentcabfdee6ceb3e0ab265907c3176d19b111c621af (diff)
downloadbuildstream-ce4bebc13a17e761dc21078b786677a00dae407b.tar.gz
tests/testutils/repo/git.py: Skip tests if git is not installed
-rw-r--r--tests/testutils/repo/git.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py
index 9ceada301..a1309bc7b 100644
--- a/tests/testutils/repo/git.py
+++ b/tests/testutils/repo/git.py
@@ -1,6 +1,9 @@
import shutil
import subprocess
+import pytest
+
from .repo import Repo
+from ..site import HAVE_GIT
GIT_ENV = {
'GIT_AUTHOR_DATE': '1320966000 +0200',
@@ -14,6 +17,11 @@ GIT_ENV = {
class Git(Repo):
+ def __init__(self, directory):
+ if not HAVE_GIT:
+ pytest.skip("git is not available")
+ super(Git, self).__init__(directory)
+
def create(self, directory):
self.copy_directory(directory, self.repo)
subprocess.call(['git', 'init', '.'], env=GIT_ENV, cwd=self.repo)