[yocto-autobuilder-helper][PATCH 2/3] scripts/test_send_qa_email.py: allow tests with non static results

Alexis Lothoré <alexis.lothore@...>

From: Alexis Lothoré <alexis.lothore@...>

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.lothore@...>
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: