<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8483</bug_id>
          
          <creation_ts>2015-10-12 01:10:24 +0000</creation_ts>
          <short_desc>Compatible to run generic pyunit test cases by test runner</short_desc>
          <delta_ts>2018-08-09 15:29:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Runtime Testing</product>
          <component>general</component>
          <version>2.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>OBSOLETE</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cathy Shen">cathy.shen</reporter>
          <assigned_to name="jingwang">jing.j.wang</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>benjamin.esquivel</cc>
    
    <cc>bill.randle</cc>
    
    <cc>costin.c.constantin</cc>
    
    <cc>jing.j.wang</cc>
    
    <cc>mariano.lopez</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>55150</commentid>
    <comment_count>0</comment_count>
    <who name="Cathy Shen">cathy.shen</who>
    <bug_when>2015-10-12 01:10:24 +0000</bug_when>
    <thetext>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&apos;d like to run by oeRuntime test runner, and get proper test result and log as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55180</commentid>
    <comment_count>1</comment_count>
    <who name="Costin">costin.c.constantin</who>
    <bug_when>2015-10-12 13:17:21 +0000</bug_when>
    <thetext>Hi Cathy,

Isn&apos;t this related to YP#8483. 

Thankyou,

Costin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55209</commentid>
    <comment_count>2</comment_count>
    <who name="Cathy Shen">cathy.shen</who>
    <bug_when>2015-10-13 05:46:14 +0000</bug_when>
    <thetext>This is YP#8483 actually. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55244</commentid>
    <comment_count>3</comment_count>
    <who name="Costin">costin.c.constantin</who>
    <bug_when>2015-10-13 10:29:34 +0000</bug_when>
    <thetext>Hi Cathy,

Apologies for earlier comment. I meant YP#8479 but don&apos;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 = &quot;something went wrong&quot;)


If so, oeRuntimeTest already inherits unittest and assures transparent communication with DUT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55253</commentid>
    <comment_count>4</comment_count>
    <who name="Costin">costin.c.constantin</who>
    <bug_when>2015-10-13 12:11:56 +0000</bug_when>
    <thetext>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 = &quot;not equal&quot;)

added the test file to the testslist in testdata.json:
    &quot;testslist&quot;: [
        &quot;oeqa.runtime.some_test&quot;
    ],
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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55871</commentid>
    <comment_count>5</comment_count>
    <who name="jingwang">jing.j.wang</who>
    <bug_when>2015-10-28 05:06:23 +0000</bug_when>
    <thetext>Zephyr TC handle target controller via TC itself, not via test runner. Thus, it is good that runexported can execute raw python unittest TC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56009</commentid>
    <comment_count>6</comment_count>
    <who name="Costin">costin.c.constantin</who>
    <bug_when>2015-10-29 15:05:03 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56718</commentid>
    <comment_count>7</comment_count>
    <who name="Cathy Shen">cathy.shen</who>
    <bug_when>2015-11-24 00:44:30 +0000</bug_when>
    <thetext>Hi Costin, thanks for the information. I think we can close this ticket since generic pytest is supported. What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56719</commentid>
    <comment_count>8</comment_count>
    <who name="jingwang">jing.j.wang</who>
    <bug_when>2015-11-24 01:05:16 +0000</bug_when>
    <thetext>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=&quot;runtime&quot;):
    if type == &quot;runtime&quot;:
        # set the context object passed from the test class
        setattr(oeTest, &quot;tc&quot;, tc)
        # set ps command to use
        setattr(oeRuntimeTest, &quot;pscmd&quot;, &quot;ps -ef&quot; if oeTest.hasPackage(&quot;procps&quot;) else &quot;ps&quot;)
        # prepare test suite, loader and runner
        suite = unittest.TestSuite()
    elif type == &quot;sdk&quot;:
        # set the context object passed from the test class
        setattr(oeTest, &quot;tc&quot;, tc)
    testloader = unittest.TestLoader()
    testloader.sortTestMethodsUsing = None
    suites = [testloader.loadTestsFromName(name) for name in tc.testslist]
    suites = filterByTagExp(suites, getattr(tc, &quot;tagexp&quot;, None))
***************************************</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56720</commentid>
    <comment_count>9</comment_count>
    <who name="jingwang">jing.j.wang</who>
    <bug_when>2015-11-24 01:11:06 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56722</commentid>
    <comment_count>10</comment_count>
    <who name="Cathy Shen">cathy.shen</who>
    <bug_when>2015-11-24 06:10:28 +0000</bug_when>
    <thetext>I&apos;m OK with this. Assign to WangJing and mark it as IN PROGRESS DESIGN. Costin, let me know if you have any concern.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63802</commentid>
    <comment_count>11</comment_count>
    <who name="Benjamin Esquivel">benjamin.esquivel</who>
    <bug_when>2016-07-11 17:08:14 +0000</bug_when>
    <thetext>Talking with the owner of this bug, seems like it can be finished by 2.2 M3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81289</commentid>
    <comment_count>12</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2018-08-09 15:29:19 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>