]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
oeqa/core/case: add file exists assertion
authorRoss Burton <ross.burton@arm.com>
Fri, 20 Jun 2025 15:14:21 +0000 (16:14 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Jun 2025 20:42:36 +0000 (21:42 +0100)
Add assertFileExists() to simply tests that want to check that a file
exists.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/core/case.py

index bc4446a938ec31eef0d3012bbfd44802ab63980b..ad5524a71428b9148b3f6b9b52e481f211f14066 100644 (file)
@@ -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