<?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>13342</bug_id>
          
          <creation_ts>2019-05-09 14:05:41 +0000</creation_ts>
          <short_desc>Create ptest helper for python unittests</short_desc>
          <delta_ts>2023-05-04 14:49:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>2.7</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>4.3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joshua Watt">JPEWhacker</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</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>83759</commentid>
    <comment_count>0</comment_count>
    <who name="Joshua Watt">JPEWhacker</who>
    <bug_when>2019-05-09 14:05:41 +0000</bug_when>
    <thetext>It would be convenient to have a wrapper of some sort that could convert the Python unittest output to ptest compatible output. This is currently done ad-hoc with a sed line (see python3&apos;s run-ptest); creating either a wrapper for this or possibly a python test runner class that outputs the correct format directly would be useful for other ptests that are written using python unittest.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83760</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-05-09 14:36:05 +0000</bug_when>
    <thetext>I did start a unittest subclass that reimplemented the output code to match what we expect, but I got stuck on making -mtest actually work with it.  I should see if I can still find it as I suspect the -mtest problem was a complication that wouldn&apos;t impact other classes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83761</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-05-09 14:36:56 +0000</bug_when>
    <thetext>Ah, poky-contrib:ross/py.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86220</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2020-01-31 13:33:06 +0000</bug_when>
    <thetext>Hmm. So that branch has disappeared.

But, relatedly, poky-contrib:ross/tap contains recipes for a few different Py TAP implementations.  Specifically pychotap 1.2.1 contains a command line unittest runner I wrote so if a Python recipe&apos;s run-ptests did this before:

$ python3 -munittest foo

It can now do:

$ python3 -mpychotap foo

And it emits nice TAP format logs.  That isn&apos;t *immediately* useful for this bug but either:

1) pychotap&apos;s __main__ can serve as a template for implementing a ptest-style formatter.
2) write a TAP-to-ptest script and pipe the TAP output into it.

As TAP is gaining traction (perl and gnome use it by default), (2) is arguably a good idea.

Making python3 -mtest work is another battle: the Py test suite is sufficiently complex that you can&apos;t just &apos;python3 -munittest test&apos; so using a different formatter isn&apos;t that easy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95417</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-04-21 18:45:42 +0000</bug_when>
    <thetext>Moved en masse from 4.2 to 4.3 by Randy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95498</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2023-05-04 14:49:12 +0000</bug_when>
    <thetext>The new recipe python3-unittest-automake-output (added in 961e4f3fc786715fc136fa446686972a4a95a3d5) has helpers for unittest and pytest.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>