Fix bug that metric test is not collected 65/28065/2
authorYujun Zhang <zhang.yujunz@zte.com.cn>
Sun, 5 Feb 2017 12:06:37 +0000 (20:06 +0800)
committerYujun Zhang <zhang.yujunz@zte.com.cn>
Sun, 5 Feb 2017 15:37:12 +0000 (23:37 +0800)
Change-Id: I2e05891a89745712274757ba9af928b03fb5edf6
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
qtip/base/constant.py
tests/unit/loader/metric_test.py
tox.ini

index ddd07e9..3957204 100644 (file)
@@ -34,6 +34,7 @@ class BaseProp(object):
 
     # content
     DESCRIPTION = 'description'
+    WORKLOADS = 'workloads'
 
 
 class SpecProp(BaseProp):
index 91d0dd2..26f144a 100644 (file)
@@ -27,8 +27,8 @@ def init_test(metric_spec):
            in str(excinfo.value)
 
 
-def list_all_test():
-    metric_list = MetricSpec.list_all()
+def list_all_test(benchmarks_root):
+    metric_list = MetricSpec.list_all(paths=[benchmarks_root])
     assert len(list(metric_list)) is 6
     for desc in metric_list:
         assert BaseProp.NAME in desc
@@ -37,8 +37,8 @@ def list_all_test():
         assert BaseProp.ABSPATH is not None
 
 
-def content_test(metric):
-    content = metric.content
+def content_test(metric_spec):
+    content = metric_spec.content
     assert BaseProp.NAME in content
     assert BaseProp.DESCRIPTION in content
     assert BaseProp.WORKLOADS in content
diff --git a/tox.ini b/tox.ini
index 16d6188..0d704b2 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -39,3 +39,7 @@ deps=-rtest-requirements.txt
 commands=
     pip-missing-reqs qtip
     pip-extra-reqs qtip
+
+[pytest]
+testpaths = tests
+python_functions = *_test test_*