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

When the test assert is about a tag in Poky, the result will not be the same
depending on existing tags at the time of running tests.

Add a LAST_TAG marker to loosen constraints but still allow to tests for general
cases (e.g. : test that tag-depending tests does not return None)

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

diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py
index ccdcba6..ce0c6b7 100755
--- a/scripts/test_send_qa_email.py
+++ b/scripts/test_send_qa_email.py
@@ -65,8 +65,17 @@ class TestVersion(unittest.TestCase):
     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'])
+                base, target = send_qa_email.get_regression_base_and_target(
+                    data['input']['basebranch'], 
data['input']['comparebranch'], data['input']['release'], 
os.environ.get("POKY_PATH"))
+                expected_base, expected_target = data["expected"]
+                # The comparison base can not be set statically in tests when 
it is supposed to be the previous tag,
+                # since the result will depend on current tags
+                if expected_base == "LAST_TAG":
+                    self.assertIsNotNone(base)
+                else:
+                    self.assertEqual(base, expected_base)
+                self.assertEqual(target, expected_target)
+
 
 if __name__ == '__main__':
     if os.environ.get("POKY_PATH") is None:
-- 
2.40.0

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

Reply via email to