From 03b2fdd33a019c4eabc8da7ba49c851bf91ffc4e Mon Sep 17 00:00:00 2001 From: "wu.zhihui" Date: Tue, 8 Nov 2016 20:18:26 +0800 Subject: Bugfix: cli.py and its unit test case since qtip use log instead of print, assert sentence need to modify. Change-Id: I8d19d0e50c4c70f34c7e916c7828984163586260 Signed-off-by: wu.zhihui --- tests/cli_test.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/cli_test.py b/tests/cli_test.py index d558329f..255c2a37 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -2,6 +2,7 @@ import pytest import mock import os from func.cli import Cli +from os.path import expanduser class TestClass: @@ -9,11 +10,11 @@ class TestClass: (['-l', 'zte', '-f', - 'compute'], "You have specified a lab that is not present in test_plan"), + 'compute'], "You have specified a lab that is not present under test_plan"), (['-l', 'default', '-f', - 'test'], "This suite file doesn't exist under benchmarks/suite/") + 'test'], "This suite file test doesn't exist under benchmarks/suite/") ]) def test_cli_error(self, capfd, test_input, expected): k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': 'fuel', 'PWD': '/home'}) @@ -21,8 +22,9 @@ class TestClass: k.start() Cli(test_input) k.stop() - resout, reserr = capfd.readouterr() - assert expected in resout + with open(expanduser('~') + "/qtip/logs/cli.log", "r") as file: + data = file.read() + assert expected in data @pytest.mark.parametrize("test_input, expected", [ (['-l', -- cgit 1.2.3-korg