scripts/test_send_qa_email.py: allow tests with non static results

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@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexis Lothoré 2023-03-23 10:20:56 +01:00 committed by Richard Purdie
parent a07dc3b832
commit c932ae37d8

View File

@ -65,8 +65,17 @@ class TestVersion(unittest.TestCase):
def test_get_regression_base_and_target(self): def test_get_regression_base_and_target(self):
for data in self.regression_inputs: for data in self.regression_inputs:
with self.subTest(data['name']): with self.subTest(data['name']):
self.assertEqual(send_qa_email.get_regression_base_and_target( base, target = send_qa_email.get_regression_base_and_target(
data['input']['basebranch'], data['input']['comparebranch'], data['input']['release'], os.environ.get("POKY_PATH")), data['expected']) 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 __name__ == '__main__':
if os.environ.get("POKY_PATH") is None: if os.environ.get("POKY_PATH") is None: