From c7a17c95377eb277bfe648f17fda9b5f22d3a30c Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 18 May 2017 00:26:26 +0200 Subject: Allow running unittest.TestCase via run_tests.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pytest_suite_runner can run any unittest.TestCase thanks to name passed as run arg. Here is the related functest/ci/testcases.yaml: run: module: 'functest.core.pytest_suite_runner' class: 'PyTestSuiteRunner' args: name: 'functest.tests.unit.odl.test_odl' Change-Id: I7c2c611c4afbad1e52bfdca4a3288ccc21491389 Signed-off-by: Cédric Ollivier --- functest/core/pytest_suite_runner.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'functest') diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py index bcbaa25d..9d787359 100644 --- a/functest/core/pytest_suite_runner.py +++ b/functest/core/pytest_suite_runner.py @@ -30,6 +30,11 @@ class PyTestSuiteRunner(testcase.TestCase): """ Starts test execution from the functest framework """ + try: + name = kwargs["name"] + self.suite = unittest.TestLoader().loadTestsFromName(name) + except KeyError: + pass self.start_time = time.time() result = unittest.TextTestRunner(verbosity=2).run(self.suite) self.stop_time = time.time() -- cgit 1.2.3-korg