Lots of test cases are generic pyunit based cases,that means no Yocto modules or classes are imported in test cases. For this kind of test cases, we'd like to run by oeRuntime test runner, and get proper test result and log as well.
Hi Cathy, Isn't this related to YP#8483. Thankyou, Costin
This is YP#8483 actually. :)
Hi Cathy, Apologies for earlier comment. I meant YP#8479 but don't think is that related now after your comment there. If i understand correct you would like to have a file mytest.py that contains? import unittest class mytests(unittest.TestCase): def test_something(self): ...# the effective work here self.assertEqual(command_status, 0, msg = "something went wrong") If so, oeRuntimeTest already inherits unittest and assures transparent communication with DUT.
Hi Cathy, I just wrote a very simple PyUnit testcase: ubnt:/opt/poky-lsb/2.0/exported_tests/oeqa/runtime# cat some_test.py import unittest class testsomething(unittest.TestCase): def test_sometest(self): a=5 self.assertEqual(5, a, msg = "not equal") added the test file to the testslist in testdata.json: "testslist": [ "oeqa.runtime.some_test" ], and than ran ./runexported.py: ubnt:/opt/poky-lsb/2.0/exported_tests# ./runexported.py SSH log file: /opt/poky-lsb/2.0/exported_tests/ssh_target_log.20151013121526 test_sometest (oeqa.runtime.some_test.testsomething) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.000s OK Does this suffices your needs? I would like to emphasize here that without inheriting oeRuntimeTest no target controller was used and thus the test itself was ran on the machine intended to launch tests against DUTs. It means the test file itself needs to implement (or inherit from somewhere) test delivery on DUT. Costin
Zephyr TC handle target controller via TC itself, not via test runner. Thus, it is good that runexported can execute raw python unittest TC.
Hi Cathy, As said,in order to use runexported.py at this moment as it is available on master, please follow indications from here: http://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#exporting-tests
Hi Costin, thanks for the information. I think we can close this ticket since generic pytest is supported. What do you think?
I take a look at the code, although pristine Pyunit is workable, it actually go through some unnecessary steps, see below. ****************************************** def loadTests(tc, type="runtime"): if type == "runtime": # set the context object passed from the test class setattr(oeTest, "tc", tc) # set ps command to use setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps") # prepare test suite, loader and runner suite = unittest.TestSuite() elif type == "sdk": # set the context object passed from the test class setattr(oeTest, "tc", tc) testloader = unittest.TestLoader() testloader.sortTestMethodsUsing = None suites = [testloader.loadTestsFromName(name) for name in tc.testslist] suites = filterByTagExp(suites, getattr(tc, "tagexp", None)) ***************************************
I suggest keep this feature/bug pending, and assign to me. I am working on a complete solution to resolve common testrunner features and project specific features.
I'm OK with this. Assign to WangJing and mark it as IN PROGRESS DESIGN. Costin, let me know if you have any concern.
Talking with the owner of this bug, seems like it can be finished by 2.2 M3.
We completed the testexport work and the exact other deliverables are unclear. Closing as obsolete to be replaced with any specific bugs for other issues.