From 6091ebc9c5ebf0a2c900f75742d62b62ee7d5ade Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 20 Jun 2025 16:14:21 +0100 Subject: [PATCH] oeqa/core/case: add file exists assertion Add assertFileExists() to simply tests that want to check that a file exists. (From OE-Core rev: b62e53a0cff2522fef3b89de875c9526a626d7dd) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/core/case.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meta/lib/oeqa/core/case.py b/meta/lib/oeqa/core/case.py index bc4446a938..ad5524a714 100644 --- a/meta/lib/oeqa/core/case.py +++ b/meta/lib/oeqa/core/case.py @@ -5,6 +5,7 @@ # import base64 +import os import zlib import unittest @@ -57,6 +58,13 @@ class OETestCase(unittest.TestCase): d.tearDownDecorator() self.tearDownMethod() + def assertFileExists(self, filename, msg=None): + """ + Test that filename exists. If it does not, the test will fail. + """ + if not os.path.exists(filename): + self.fail(msg or "%s does not exist" % filename) + class OEPTestResultTestCase: """ Mix-in class to provide functions to make interacting with extraresults for