diff options
author | Emma Foley <emma.l.foley@intel.com> | 2018-03-12 15:07:59 +0000 |
---|---|---|
committer | Emma Foley <emma.l.foley@intel.com> | 2018-06-13 18:37:41 +0000 |
commit | 55d59992c6695e2ba4093b1d76905f3263dfba3e (patch) | |
tree | e9aa2e5f71fb9fe99e02d7c6066997efc044ad0d /yardstick/tests/unit/benchmark/core/test_report.py | |
parent | a3399d07b83ce0e50d9c0144d00a7ba83a73390f (diff) |
assert[Greater,Equal] -> assert_{,not_}called
assertEqual(mock_xxx.call_count, 1) -> mock_xxx.assert_called_once
assertEqual(mock_xxx.call_count, 0) -> mock_xxx.assert_not_called
assertGreater(mock.call_count, 0) -> mock.assert_called()
assertGreaterEqual(mock.call_count, 1) -> mock.assert_called()
JIRA: YARDSTICK-1069
Change-Id: I890084d120c8e78304e169e2a0e5d30011a41525
Signed-off-by: Emma Foley <emma.l.foley@intel.com>
Diffstat (limited to 'yardstick/tests/unit/benchmark/core/test_report.py')
-rw-r--r-- | yardstick/tests/unit/benchmark/core/test_report.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/yardstick/tests/unit/benchmark/core/test_report.py b/yardstick/tests/unit/benchmark/core/test_report.py index a684ad750..524302f92 100644 --- a/yardstick/tests/unit/benchmark/core/test_report.py +++ b/yardstick/tests/unit/benchmark/core/test_report.py @@ -42,16 +42,16 @@ class ReportTestCase(unittest.TestCase): self.param.task_id = [FAKE_TASK_ID] self.rep = report.Report() - @mock.patch('yardstick.benchmark.core.report.Report._get_tasks') - @mock.patch('yardstick.benchmark.core.report.Report._get_fieldkeys') - @mock.patch('yardstick.benchmark.core.report.Report._validate') + @mock.patch.object(report.Report, '_get_tasks') + @mock.patch.object(report.Report, '_get_fieldkeys') + @mock.patch.object(report.Report, '_validate') def test_generate_success(self, mock_valid, mock_keys, mock_tasks): mock_tasks.return_value = FAKE_DB_TASK mock_keys.return_value = FAKE_DB_FIELDKEYS self.rep.generate(self.param) mock_valid.assert_called_once_with(FAKE_YAML_NAME, FAKE_TASK_ID) - self.assertEqual(1, mock_tasks.call_count) - self.assertEqual(1, mock_keys.call_count) + mock_tasks.assert_called_once_with() + mock_keys.assert_called_once_with() # pylint: disable=deprecated-method def test_invalid_yaml_name(self): |