diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2023-04-13 10:33:20 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2023-04-13 15:59:50 +0200 |
commit | f88f3076d913394a75871fcec65de0e6cd497289 (patch) | |
tree | 91ff3833accf18b7cda0a9ace25a48855f426911 /xtesting | |
parent | 4036662725b3ec37097452172401160d04f6fa37 (diff) |
Allow setting env vars via testcases.yaml
It helps defining env vars per test cases.
/home/opnfv/functest/conf/env_file is rather designed
for comme env vars ro all test cases (see OpenStack Creds).
Change-Id: Ic5d34701475440e1f768bbb22be7a4cfa3e1625b
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit fd8498598096cabb991cf3494220a9715d3360f7)
Diffstat (limited to 'xtesting')
-rw-r--r-- | xtesting/ci/run_tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py index 90409a7f..4e22f612 100644 --- a/xtesting/ci/run_tests.py +++ b/xtesting/ci/run_tests.py @@ -143,6 +143,7 @@ class Runner(): def run_test(self, test): """Run one test case""" + # pylint: disable=too-many-branches if not test.is_enabled() or test.is_skipped(): msg = prettytable.PrettyTable( header_style='upper', padding_width=5, @@ -168,6 +169,11 @@ class Runner(): LOGGER.info("Skipping test case '%s'...", test.get_name()) LOGGER.info("Test result:\n\n%s\n", test_case) return testcase.TestCase.EX_TESTCASE_SKIPPED + if 'env' in run_dict: + LOGGER.info( + "Setting env for test case '%s'...", test.get_name()) + for key, value in run_dict['env'].items(): + os.environ[key] = str(value) LOGGER.info("Running test case '%s'...", test.get_name()) try: kwargs = run_dict['args'] |