aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-06-18 13:14:46 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-06-19 01:08:39 +0200
commit0914c7e7011b7ba3ed9eeae7f6c3605afb711640 (patch)
tree92cc8701b0cb63e1ae90990e83c13c63a72e2551
parent3f46c1858ccfc08dc6b5a5a5ce123f2f3fcf2234 (diff)
Stop getting git data from functest dir
Functest is no longer a git clone. Change-Id: Ieaceacaa820e9a7a3c64e8c1fbd2a8a9321f234d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/cli/commands/cli_env.py11
-rw-r--r--functest/tests/unit/cli/commands/test_cli_env.py14
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py22
-rw-r--r--functest/utils/functest_utils.py10
4 files changed, 0 insertions, 57 deletions
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index b43116fcd..8094c84e5 100644
--- a/functest/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -10,7 +10,6 @@
import os
import click
-import git
import prettytable
from functest.utils.constants import CONST
@@ -49,14 +48,6 @@ class CliEnv(object):
installer_info = ("%s, %s" % (install_type, installer_ip))
scenario = _get_value(CONST.__getattribute__('DEPLOY_SCENARIO'))
node = _get_value(CONST.__getattribute__('NODE_NAME'))
- repo_h = git.Repo(CONST.__getattribute__('dir_repo_functest')).head
- if repo_h.is_detached:
- git_branch = 'detached from FETCH_HEAD'
- git_hash = repo_h.commit.hexsha
- else:
- branch = repo_h.reference
- git_branch = branch.name
- git_hash = branch.commit.hexsha
is_debug = _get_value(CONST.__getattribute__('CI_DEBUG'), 'false')
build_tag = CONST.__getattribute__('BUILD_TAG')
if build_tag is not None:
@@ -73,8 +64,6 @@ class CliEnv(object):
msg.add_row(['INSTALLER', installer_info])
msg.add_row(['SCENARIO', scenario])
msg.add_row(['POD', node])
- msg.add_row(['GIT BRANCH', git_branch])
- msg.add_row(['GIT HASH', git_hash])
if build_tag:
msg.add_row(['BUILD TAG', build_tag])
msg.add_row(['DEBUG FLAG', is_debug])
diff --git a/functest/tests/unit/cli/commands/test_cli_env.py b/functest/tests/unit/cli/commands/test_cli_env.py
index 14e926eb9..b4e987871 100644
--- a/functest/tests/unit/cli/commands/test_cli_env.py
+++ b/functest/tests/unit/cli/commands/test_cli_env.py
@@ -8,7 +8,6 @@
import logging
import unittest
-from git.exc import NoSuchPathError
import mock
from functest.cli.commands import cli_env
@@ -72,42 +71,29 @@ class CliEnvTesting(unittest.TestCase):
mock_click_echo.assert_called_with(test_utils.
RegexMatch(reg_string))
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_installer_type(self, *args):
self._test_show_missing_env_var('INSTALLER_TYPE', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_installer_ip(self, *args):
self._test_show_missing_env_var('INSTALLER_IP', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_scenario(self, *args):
self._test_show_missing_env_var('SCENARIO', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_node(self, *args):
self._test_show_missing_env_var('NODE', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_build_tag(self, *args):
self._test_show_missing_env_var('BUILD_TAG', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_debug(self, *args):
self._test_show_missing_env_var('DEBUG', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
@mock.patch('functest.cli.commands.cli_env.os.path.isfile',
return_value=False)
def test_show_missing_environment(self, *args):
self._test_show_missing_env_var('STATUS', *args)
- @mock.patch('functest.cli.commands.cli_env.os.path.exists',
- return_value=False)
- def test_show_missing_git_repo_dir(self, *args):
- CONST.__setattr__('dir_repo_functest', None)
- self.assertRaises(NoSuchPathError, lambda: self.cli_environ.show())
-
@mock.patch('functest.cli.commands.cli_env.click.echo')
@mock.patch('functest.cli.commands.cli_env.os.path.isfile',
return_value=True)
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index 6f7976e4b..fbfa420aa 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -13,7 +13,6 @@ import os
import time
import unittest
-from git.exc import NoSuchPathError
import mock
import requests
from six.moves import urllib
@@ -98,27 +97,6 @@ class FunctestUtilsTesting(unittest.TestCase):
m.assert_called_once_with(dest, 'wb')
self.assertTrue(mock_sh.called)
- def test_get_git_branch(self):
- with mock.patch('functest.utils.functest_utils.Repo') as mock_repo:
- mock_obj2 = mock.Mock()
- attrs = {'name': 'test_branch'}
- mock_obj2.configure_mock(**attrs)
-
- mock_obj = mock.Mock()
- attrs = {'active_branch': mock_obj2}
- mock_obj.configure_mock(**attrs)
-
- mock_repo.return_value = mock_obj
- self.assertEqual(functest_utils.get_git_branch(self.repo_path),
- 'test_branch')
-
- @mock.patch('functest.utils.functest_utils.Repo',
- side_effect=NoSuchPathError)
- def test_get_git_branch_failed(self, mock_repo):
- self.assertRaises(NoSuchPathError,
- lambda: functest_utils.get_git_branch(self.repo_path
- ))
-
@mock.patch('functest.utils.functest_utils.logger.error')
def test_get_installer_type_failed(self, mock_logger_error):
with mock.patch.dict(os.environ,
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index 995d94ff0..d8cfabce0 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -22,7 +22,6 @@ import dns.resolver
import requests
from six.moves import urllib
import yaml
-from git import Repo
from functest.utils import constants
from functest.utils import decorators
@@ -68,15 +67,6 @@ def download_url(url, dest_path):
# CI UTILS
#
# -----------------------------------------------------------
-def get_git_branch(repo_path):
- """
- Get git branch name
- """
- repo = Repo(repo_path)
- branch = repo.active_branch
- return branch.name
-
-
def get_installer_type():
"""
Get installer type (fuel, apex, joid, compass)