summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r--tests/unit/benchmark/core/test_task.py36
-rw-r--r--tests/unit/benchmark/core/test_testcase.py4
2 files changed, 22 insertions, 18 deletions
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index 5dd32ea17..c56e21047 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -24,6 +24,7 @@ except ImportError:
from yardstick.benchmark.core import task
+from yardstick.common import constants as consts
class TaskTestCase(unittest.TestCase):
@@ -92,10 +93,10 @@ class TaskTestCase(unittest.TestCase):
task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
- self.assertEqual(task_files[0],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
- self.assertEqual(task_files[1],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_files[0], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml'))
+ self.assertEqual(task_files[1], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml'))
self.assertEqual(task_args[0], None)
self.assertEqual(task_args[1], None)
self.assertEqual(task_args_fnames[0], None)
@@ -109,10 +110,10 @@ class TaskTestCase(unittest.TestCase):
task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
- self.assertEqual(task_files[0],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
- self.assertEqual(task_files[1],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_files[0], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml'))
+ self.assertEqual(task_files[1], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml'))
self.assertEqual(task_args[0], None)
self.assertEqual(task_args[1],
'{"host": "node1.LF","target": "node2.LF"}')
@@ -127,10 +128,10 @@ class TaskTestCase(unittest.TestCase):
task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
- self.assertEqual(task_files[0],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
- self.assertEqual(task_files[1],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_files[0], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml'))
+ self.assertEqual(task_files[1], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml'))
self.assertEqual(task_args[0], None)
self.assertEqual(task_args[1], None)
self.assertEqual(task_args_fnames[0], None)
@@ -144,10 +145,10 @@ class TaskTestCase(unittest.TestCase):
task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
- self.assertEqual(task_files[0],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
- self.assertEqual(task_files[1],
- 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_files[0], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml'))
+ self.assertEqual(task_files[1], self.change_to_abspath(
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml'))
self.assertEqual(task_args[0], None)
self.assertEqual(task_args[1],
'{"host": "node1.LF","target": "node2.LF"}')
@@ -159,6 +160,9 @@ class TaskTestCase(unittest.TestCase):
file_path = os.path.join(curr_path, filename)
return file_path
+ def change_to_abspath(self, filepath):
+ return os.path.join(consts.YARDSTICK_ROOT_PATH, filepath)
+
def main():
unittest.main()
diff --git a/tests/unit/benchmark/core/test_testcase.py b/tests/unit/benchmark/core/test_testcase.py
index c7da2de7c..1f5aad75e 100644
--- a/tests/unit/benchmark/core/test_testcase.py
+++ b/tests/unit/benchmark/core/test_testcase.py
@@ -28,13 +28,13 @@ class TestcaseUT(unittest.TestCase):
def test_list_all(self):
t = testcase.Testcase()
result = t.list_all("")
- self.assertEqual(result, True)
+ self.assertIsInstance(result, list)
def test_show(self):
t = testcase.Testcase()
casename = Arg()
result = t.show(casename)
- self.assertEqual(result, True)
+ self.assertTrue(result)
def main():