From: Alexis Lothoré <alexis.loth...@bootlin.com>

Signed-off-by: Alexis Lothoré <alexis.loth...@bootlin.com>
---
 scripts/test_send_qa_email.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py
index 48bca98..ccdcba6 100755
--- a/scripts/test_send_qa_email.py
+++ b/scripts/test_send_qa_email.py
@@ -35,6 +35,21 @@ class TestVersion(unittest.TestCase):
         {"input": None, "expected":False}
     ]
 
+    # This data represent real data returned by utils.getcomparisonbranch
+    # and the release argument passed to send-qa-email script
+    regression_inputs = [
+        {"name": "Arbitrary branch", "input": {"basebranch": None,
+                                               "comparebranch": None, 
"release": None}, "expected": (None, None)},
+        {"name": "Master release", "input": {"basebranch": "master",
+                                             "comparebranch": None, "release": 
"yocto-4.2_M3.rc1"}, "expected": ("4.2_M2", "master")},
+        {"name": "Older release", "input": {"basebranch": "kirkstone",
+                                            "comparebranch": None, "release": 
"yocto-4.0.8.rc2"}, "expected": ("yocto-4.0.7", "kirkstone")},
+        {"name": "Master Next", "input": {"basebranch": "master-next",
+                                          "comparebranch": "master", 
"release": None}, "expected": ("master", "master-next")},
+        {"name": "Fork Master Next", "input": {"basebranch": "ross/mut",
+                                               "comparebranch": "master", 
"release": None}, "expected": ("master", "ross/mut")},
+    ]
+
     def test_versions(self):
         for data in self.test_data_get_version:
             test_name = data["input"]["version"]
@@ -47,6 +62,12 @@ class TestVersion(unittest.TestCase):
             with self.subTest(f"{data['input']}"):
                 
self.assertEqual(send_qa_email.is_release_version(data['input']), 
data['expected'])
 
+    def test_get_regression_base_and_target(self):
+        for data in self.regression_inputs:
+            with self.subTest(data['name']):
+                self.assertEqual(send_qa_email.get_regression_base_and_target(
+                    data['input']['basebranch'], 
data['input']['comparebranch'], data['input']['release'], 
os.environ.get("POKY_PATH")), data['expected'])
+
 if __name__ == '__main__':
     if os.environ.get("POKY_PATH") is None:
         print("Please set POKY_PATH to proper poky clone location before 
running tests")
-- 
2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#59416): https://lists.yoctoproject.org/g/yocto/message/59416
Mute This Topic: https://lists.yoctoproject.org/mt/97582170/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to