aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting
diff options
context:
space:
mode:
authorFrancois Regis Menguy <francoisregis.menguy@orange.com>2021-04-26 15:09:11 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2021-08-19 15:15:25 +0200
commitfe410d665c61a1c7ffd4d9b751639050dcc4a252 (patch)
tree8cd7b7b8638f0266c01ad00bd358fecfa5db8d41 /xtesting
parent01823dd19553b8e89a1b8895f53a1be371bfcef5 (diff)
Add console parameter to behaveframework
Change-Id: I289de43bdea8c52181ec0622c83c5c56dd6890e3 Signed-off-by: Francois Regis Menguy <francoisregis.menguy@orange.com> (cherry picked from commit 05013a4caa67062ddae4b570f67b77365a96e326)
Diffstat (limited to 'xtesting')
-rw-r--r--xtesting/core/behaveframework.py2
-rw-r--r--xtesting/tests/unit/core/test_behaveframework.py13
2 files changed, 11 insertions, 4 deletions
diff --git a/xtesting/core/behaveframework.py b/xtesting/core/behaveframework.py
index 2b41614c..dacda27d 100644
--- a/xtesting/core/behaveframework.py
+++ b/xtesting/core/behaveframework.py
@@ -97,6 +97,8 @@ class BehaveFramework(testcase.TestCase):
html_file = os.path.join(self.res_dir, 'output.html')
config += ['--format=behave_html_formatter:HTMLFormatter',
'--outfile={}'.format(html_file)]
+ if kwargs.get("console", False):
+ config += ['--format=pretty', '--outfile=-']
for feature in suites:
config.append(feature)
self.start_time = time.time()
diff --git a/xtesting/tests/unit/core/test_behaveframework.py b/xtesting/tests/unit/core/test_behaveframework.py
index 414d96b5..2baaba03 100644
--- a/xtesting/tests/unit/core/test_behaveframework.py
+++ b/xtesting/tests/unit/core/test_behaveframework.py
@@ -146,10 +146,10 @@ class RunTesting(unittest.TestCase):
@mock.patch('os.makedirs')
@mock.patch('xtesting.core.behaveframework.behave_main')
- def _test_parse_results(self, status, *args):
+ def _test_parse_results(self, status, console, *args):
self.assertEqual(
self.test.run(
- suites=self.suites, tags=self.tags),
+ suites=self.suites, tags=self.tags, console=console),
status)
html_file = os.path.join(self.test.res_dir, 'output.html')
args_list = [
@@ -160,16 +160,21 @@ class RunTesting(unittest.TestCase):
args_list += [
'--format=behave_html_formatter:HTMLFormatter',
'--outfile={}'.format(html_file)]
+ if console:
+ args_list += ['--format=pretty', '--outfile=-']
args_list.append('foo')
args[0].assert_called_once_with(args_list)
args[1].assert_called_once_with(self.test.res_dir)
- def test_parse_results_exc(self):
+ def test_parse_results_exc(self, console=False):
with mock.patch.object(self.test, 'parse_results',
side_effect=Exception) as mock_method:
- self._test_parse_results(self.test.EX_RUN_ERROR)
+ self._test_parse_results(self.test.EX_RUN_ERROR, console)
mock_method.assert_called_once_with()
+ def test_parse_results_exc_console(self):
+ self.test_parse_results_exc(console=True)
+
if __name__ == "__main__":
logging.disable(logging.CRITICAL)