mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
oeqa/sdk/cases: Migrate tests to the new OEQA framework
Summary of the changes: - Remove auto extend_path using pkgutil at __init__, is not needed. - Change base class to OESDKTestCase. - Add td_vars attr to set dependencies of certain variables in test data. - Change skips from module level to class level because Test context (tc) now isn't at module level. - Variable names changes to be consistent (i.e. sdktestdir -> sdk_dir). [YOCTO #10599] - Don't use bb.utils functions use instead remove_safe and shutil for copy files. - SDKBuildProject pass test data variables instead of call getVar inside. [YOCTO #10231] (From OE-Core rev: 91cd1ed19a3f34c29cd77eb136036975fe465444) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
51be188063
commit
c9fe59d7c5
@@ -1,26 +1,25 @@
|
||||
import unittest
|
||||
import os
|
||||
import shutil
|
||||
from oeqa.oetest import oeSDKTest, skipModule
|
||||
from oeqa.utils.decorators import *
|
||||
import unittest
|
||||
|
||||
def setUpModule():
|
||||
if not oeSDKTest.hasHostPackage("nativesdk-python"):
|
||||
skipModule("No python package in the SDK")
|
||||
|
||||
|
||||
class PythonTest(oeSDKTest):
|
||||
from oeqa.core.utils.path import remove_safe
|
||||
from oeqa.sdk.case import OESDKTestCase
|
||||
|
||||
class PythonTest(OESDKTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
if not self.tc.hasHostPackage("nativesdk-python"):
|
||||
raise unittest.SkipTest("No python package in the SDK")
|
||||
|
||||
for f in ['test.py']:
|
||||
shutil.copyfile(os.path.join(self.tc.filesdir, f), self.tc.sdktestdir + f)
|
||||
shutil.copyfile(os.path.join(self.tc.files_dir, f),
|
||||
os.path.join(self.tc.sdk_dir, f))
|
||||
|
||||
def test_python_exists(self):
|
||||
self._run('which python')
|
||||
|
||||
def test_python_stdout(self):
|
||||
output = self._run('python %s/test.py' % self.tc.sdktestdir)
|
||||
output = self._run('python %s/test.py' % self.tc.sdk_dir)
|
||||
self.assertEqual(output.strip(), "the value of a is 0.01", msg="Incorrect output: %s" % output)
|
||||
|
||||
def test_python_testfile(self):
|
||||
@@ -28,5 +27,5 @@ class PythonTest(oeSDKTest):
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
bb.utils.remove("%s/test.py" % self.tc.sdktestdir)
|
||||
bb.utils.remove("/tmp/testfile.python")
|
||||
remove_safe("%s/test.py" % self.tc.sdk_dir)
|
||||
remove_safe("/tmp/testfile.python")
|
||||
|
||||
Reference in New Issue
Block a user