diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2022-03-03 11:19:47 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2022-03-03 12:25:02 +0100 |
commit | 98189214d82232f8a24a3a53c9033cd782157635 (patch) | |
tree | b0bd74fb4305a2a3bb5353834ed4d836d5fa40e0 /xtesting/tests/unit | |
parent | 3ec9bb21261db80268d2a0b8bd64198c9225dfe8 (diff) |
Allow overriding project_name via env
It now offers a new env var, PROJECT_NAME, to override the default
value in testcases.yaml.
Change-Id: I911f1af56afe88edb37de40176733b65bc8e490a
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit 318c2e427e2933fdff2213bf807249c66628b56f)
Diffstat (limited to 'xtesting/tests/unit')
-rw-r--r-- | xtesting/tests/unit/core/test_testcase.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/xtesting/tests/unit/core/test_testcase.py b/xtesting/tests/unit/core/test_testcase.py index 990883c6..dbefd974 100644 --- a/xtesting/tests/unit/core/test_testcase.py +++ b/xtesting/tests/unit/core/test_testcase.py @@ -42,6 +42,24 @@ class AbstractTestCaseTesting(unittest.TestCase): testcase.TestCase(case_name="base", project_name="xtesting") +class ProjectNameTesting(unittest.TestCase): + + _case_name = "base" + _project_name = "xtesting" + + def test_project_name_yaml(self): + test = FakeTestCase( + case_name=self._case_name, project_name=self._project_name) + self.assertEqual(self._project_name, test.project_name) + + def test_project_name_env(self): + os.environ['PROJECT_NAME'] = 'whatever' + test = FakeTestCase( + case_name=self._case_name, project_name=self._project_name) + self.assertEqual('whatever', test.project_name) + del os.environ['PROJECT_NAME'] + + class TestCaseTesting(unittest.TestCase): # pylint: disable=too-many-instance-attributes,too-many-public-methods |