From c932ae37d8891c6c41b0f01fb1e77ab1ca8aaf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= Date: Thu, 23 Mar 2023 10:20:56 +0100 Subject: [PATCH] scripts/test_send_qa_email.py: allow tests with non static results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Signed-off-by: Richard Purdie --- 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: