@@ -95,4 +95,4 @@ class OETestDepends(OETestDiscover):
return [registry['cases'][case_id] for case_id in registry['cases']]
def setUpDecorator(self):
- _skipTestDependency(self.case, self.depends)
+ _skipTestDependency(self.case, self.case.tc._registry['depends'][self.case.id()])
@@ -112,6 +112,20 @@ class TestDependsDecorator(TestBase):
msg = 'Expected OEQADependency exception having a circular dependency'
self.assertTrue(result, msg=msg)
+ def test_depends_run(self):
+ # Dependencies given relative to the class must be found when the
+ # tests run, otherwise the dependent tests are skipped
+ tests = ['depends.DependsTest.testDependsFirst',
+ 'depends.DependsTest.testDependsSecond',
+ 'depends.DependsTest.testDependsThird',
+ 'depends.DependsTest.testDependsFourth',
+ 'depends.DependsTest.testDependsFifth']
+ tc = self._testLoader(modules=self.modules, tests=tests)
+ result = tc.runTests()
+ self.assertTrue(result.wasSuccessful())
+ self.assertEqual(result.skipped, [])
+ self.assertEqual(len(result.successes), len(tests))
+
class TestTimeoutDecorator(TestBase):
modules = ['timeout']
OETestDepends allows dependencies to be given relative to the test's module or class and bind() resolves these to full test ids for ordering. The runtime check compared the dependencies as written with the ids of the passed tests though, so a test with a relative dependency was always skipped, e.g. test_example_depends in the core example tests. Use the resolved ids from the registry to avoid that. Add a test which runs tests with relative dependencies. AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- meta/lib/oeqa/core/decorator/depends.py | 2 +- meta/lib/oeqa/core/tests/test_decorators.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)