diff options
-rw-r--r-- | functest/core/feature.py | 2 | ||||
-rw-r--r-- | functest/tests/unit/core/test_feature.py | 2 | ||||
-rw-r--r-- | functest/tests/unit/odl/test_odl.py | 12 |
3 files changed, 11 insertions, 5 deletions
diff --git a/functest/core/feature.py b/functest/core/feature.py index ed9efc70..8563c925 100644 --- a/functest/core/feature.py +++ b/functest/core/feature.py @@ -32,7 +32,7 @@ class Feature(base.TestCase): def __init__(self, **kwargs): super(Feature, self).__init__(**kwargs) self.result_file = "{}/{}.log".format( - CONST.__getattribute__('dir_results'), self.project_name) + CONST.__getattribute__('dir_results'), self.case_name) def execute(self, **kwargs): """Execute the Python method. diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py index 993da5a0..8de42ec5 100644 --- a/functest/tests/unit/core/test_feature.py +++ b/functest/tests/unit/core/test_feature.py @@ -28,7 +28,7 @@ class FeatureTestingBase(unittest.TestCase): _project_name = "bar" _repo = "dir_repo_copper" _cmd = "cd /home/opnfv/repos/foo/tests && bash run.sh && cd -" - _output_file = '/home/opnfv/functest/results/bar.log' + _output_file = '/home/opnfv/functest/results/foo.log' feature = None @mock.patch('time.time', side_effect=[1, 2]) diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index 54d6da72..f3d37c65 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -337,9 +337,11 @@ class ODLMainTesting(ODLTesting): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(odl, 'open', mock.mock_open(), - create=True), \ + create=True) as mock_open, \ mock.patch.object(self.test, 'parse_results'): self._test_main(testcase.TestCase.EX_OK, *args) + mock_open.assert_called_once_with( + os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+') @mock.patch('os.remove') @mock.patch('robot.run', return_value=1) @@ -348,9 +350,11 @@ class ODLMainTesting(ODLTesting): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(odl, 'open', mock.mock_open(), - create=True), \ + create=True) as mock_open, \ mock.patch.object(self.test, 'parse_results'): self._test_main(testcase.TestCase.EX_OK, *args) + mock_open.assert_called_once_with( + os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+') @mock.patch('os.remove', side_effect=OSError) @mock.patch('robot.run') @@ -359,9 +363,11 @@ class ODLMainTesting(ODLTesting): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(odl, 'open', mock.mock_open(), - create=True), \ + create=True) as mock_open, \ mock.patch.object(self.test, 'parse_results'): self._test_main(testcase.TestCase.EX_OK, *args) + mock_open.assert_called_once_with( + os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+') class ODLRunTesting(ODLTesting): |