#
import os
-import pkg_resources
import click
import prettytable
else:
answer = raw_input("Invalid answer. Please type [y|n]\n")
- cmd = ("python %s start" % pkg_resources.resource_filename(
- 'functest', 'ci/prepare_env.py'))
- ft_utils.execute_command(cmd)
+ ft_utils.execute_command("prepare_env start")
def show(self):
def _get_value(attr, default='Unknown'):
else:
tests = testname.split(",")
for test in tests:
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- flags, test))
+ cmd = "run_tests {}-t {}".format(flags, test)
ft_utils.execute_command(cmd)
click.echo("Functest environment is not ready. "
"Run first 'functest env prepare'")
else:
- cmd = ("python %s %s -t %s" % (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'), flags, tiername))
+ cmd = "run_tests {}-t {}".format(flags, tiername)
ft_utils.execute_command(cmd)
# http://www.apache.org/licenses/LICENSE-2.0
import logging
-import pkg_resources
import unittest
import mock
return_value=False)
@mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
def test_prepare_default(self, mock_ft_utils, mock_os):
- cmd = ("python %s start" % pkg_resources.resource_filename(
- 'functest', 'ci/prepare_env.py'))
+ cmd = "prepare_env start"
self.cli_environ.prepare()
mock_ft_utils.assert_called_with(cmd)
with mock.patch('__builtin__.raw_input', return_value="y"), \
mock.patch('functest.cli.commands.cli_testcase.os.remove') \
as mock_os_remove:
- cmd = ("python %s start" % pkg_resources.resource_filename(
- 'functest', 'ci/prepare_env.py'))
+ cmd = "prepare_env start"
self.cli_environ.prepare()
mock_os_remove.assert_called_once_with(
CONST.__getattribute__('env_active'))
import logging
-import pkg_resources
import unittest
import mock
return_value=True)
@mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
def test_run_default(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "-n -r ", self.testname))
+ cmd = "run_tests -n -r -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=True, report=True)
mock_ft_utils.assert_called_with(cmd)
return_value=True)
@mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
def test_run_noclean_missing_report(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "-n ", self.testname))
+ cmd = "run_tests -n -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=True, report=False)
mock_ft_utils.assert_called_with(cmd)
return_value=True)
@mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
def test_run_report_missing_noclean(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "-r ", self.testname))
+ cmd = "run_tests -r -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=False, report=True)
mock_ft_utils.assert_called_with(cmd)
return_value=True)
@mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
def test_run_missing_noclean_report(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "", self.testname))
+ cmd = "run_tests -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=False, report=False)
mock_ft_utils.assert_called_with(cmd)
import logging
-import pkg_resources
import unittest
import mock
return_value=True)
@mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
def test_run_default(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "-n -r ", self.tiername))
+ cmd = "run_tests -n -r -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=True, report=True)
mock_ft_utils.assert_called_with(cmd)
return_value=True)
@mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
def test_run_report_missing_noclean(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "-r ", self.tiername))
+ cmd = "run_tests -r -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=False, report=True)
mock_ft_utils.assert_called_with(cmd)
return_value=True)
@mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
def test_run_noclean_missing_report(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "-n ", self.tiername))
+ cmd = "run_tests -n -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=True, report=False)
mock_ft_utils.assert_called_with(cmd)
return_value=True)
@mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
def test_run_missing_noclean_report(self, mock_ft_utils, mock_os):
- cmd = ("python %s %s -t %s" %
- (pkg_resources.resource_filename(
- 'functest', 'ci/run_tests.py'),
- "", self.tiername))
+ cmd = "run_tests -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=False, report=False)
mock_ft_utils.assert_called_with(cmd)