diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-05-18 00:26:26 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-05-18 00:37:16 +0200 |
commit | c7a17c95377eb277bfe648f17fda9b5f22d3a30c (patch) | |
tree | 34312dd20b163a88e1a0aa1fd9b8e4ff5e4367f2 | |
parent | 57da7080488785813adcaff4e2410e2338dccf2a (diff) |
Allow running unittest.TestCase via run_tests.py
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 <cedric.ollivier@orange.com>
-rw-r--r-- | functest/core/pytest_suite_runner.py | 5 |
1 files changed, 5 insertions, 0 deletions
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() |