aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/ci
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-08-10 12:55:10 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-08-12 18:32:59 +0200
commit95092b511dbacac412dbe5b8ff3a28abb3d3f664 (patch)
tree24a547cf1a687af0d4db184375abcc03aef998ba /xtesting/ci
parenta9491ef0948f8fe3eb3772b6b6ae44d86bde7e9b (diff)
Leverage on abc and stevedore
Change-Id: I7b3c4c0c5dd0c9e6fb3e52c3fff5221d4b831b02 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/ci')
-rw-r--r--xtesting/ci/run_tests.py10
-rw-r--r--xtesting/ci/testcases.yaml12
2 files changed, 10 insertions, 12 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py
index 59ed5617..3a3e6858 100644
--- a/xtesting/ci/run_tests.py
+++ b/xtesting/ci/run_tests.py
@@ -15,7 +15,6 @@
import argparse
import errno
-import importlib
import logging
import logging.config
import os
@@ -27,6 +26,7 @@ import enum
import pkg_resources
import prettytable
import six
+from stevedore import driver
import yaml
from xtesting.ci import tier_builder
@@ -151,10 +151,12 @@ class Runner(object):
if run_dict:
try:
LOGGER.info("Loading test case '%s'...", test.get_name())
- module = importlib.import_module(run_dict['module'])
- cls = getattr(module, run_dict['class'])
test_dict = Runner.get_dict_by_test(test.get_name())
- test_case = cls(**test_dict)
+ test_case = driver.DriverManager(
+ namespace='xtesting.testcase',
+ name=run_dict['name'],
+ invoke_on_load=True,
+ invoke_kwds=test_dict).driver
self.executed_test_cases[test.get_name()] = test_case
test_case.check_requirements()
if test_case.is_skipped:
diff --git a/xtesting/ci/testcases.yaml b/xtesting/ci/testcases.yaml
index 6ab5927f..7c621fd0 100644
--- a/xtesting/ci/testcases.yaml
+++ b/xtesting/ci/testcases.yaml
@@ -13,8 +13,7 @@ tiers:
clean_flag: false
description: ''
run:
- module: 'xtesting.samples.first'
- class: 'Test'
+ name: 'first'
-
case_name: second
@@ -24,8 +23,7 @@ tiers:
clean_flag: false
description: ''
run:
- module: 'xtesting.samples.second'
- class: 'Test'
+ name: 'second'
-
case_name: third
@@ -35,8 +33,7 @@ tiers:
clean_flag: false
description: ''
run:
- module: 'xtesting.core.feature'
- class: 'BashFeature'
+ name: 'bashfeature'
args:
cmd: 'echo -n Hello World; exit 0'
@@ -48,8 +45,7 @@ tiers:
clean_flag: false
description: ''
run:
- module: 'xtesting.core.unit'
- class: 'Suite'
+ name: 'unit'
args:
name: 'xtesting.samples.fourth'