aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting
diff options
context:
space:
mode:
Diffstat (limited to 'xtesting')
-rw-r--r--xtesting/core/testcase.py3
-rw-r--r--xtesting/tests/unit/core/test_testcase.py18
2 files changed, 20 insertions, 1 deletions
diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py
index bccf76d2..744a59f1 100644
--- a/xtesting/core/testcase.py
+++ b/xtesting/core/testcase.py
@@ -62,7 +62,8 @@ class TestCase():
def __init__(self, **kwargs):
self.details = {}
- self.project_name = kwargs.get('project_name', 'xtesting')
+ self.project_name = os.environ.get(
+ 'PROJECT_NAME', kwargs.get('project_name', 'xtesting'))
self.case_name = kwargs.get('case_name', '')
self.criteria = kwargs.get('criteria', 100)
self.result = 0
diff --git a/xtesting/tests/unit/core/test_testcase.py b/xtesting/tests/unit/core/test_testcase.py
index 63bfc3fe..c1f3bab5 100644
--- a/xtesting/tests/unit/core/test_testcase.py
+++ b/xtesting/tests/unit/core/test_testcase.py
@@ -41,6 +41,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