[PATCH v2 23/25] tools/lib/python/unittest_helper.py

Mauro Carvalho Chehab posted 25 patches 1 week, 3 days ago
There is a newer version of this series
[PATCH v2 23/25] tools/lib/python/unittest_helper.py
Posted by Mauro Carvalho Chehab 1 week, 3 days ago
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 tools/lib/python/unittest_helper.py | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/tools/lib/python/unittest_helper.py b/tools/lib/python/unittest_helper.py
index e438472fa704..3cf1075b1de4 100755
--- a/tools/lib/python/unittest_helper.py
+++ b/tools/lib/python/unittest_helper.py
@@ -8,21 +8,7 @@
 Helper class to better display unittest results.
 
 Those help functions provide a nice colored output summary of each
-executed test and, when a test fails, it shows the different in diff
-format when running in verbose mode, like::
-
-    $ tools/unittests/nested_match.py -v
-    ...
-    Traceback (most recent call last):
-    File "/new_devel/docs/tools/unittests/nested_match.py", line 69, in test_count_limit
-        self.assertEqual(replaced, "bar(a); bar(b); foo(c)")
-        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    AssertionError: 'bar(a) foo(b); foo(c)' != 'bar(a); bar(b); foo(c)'
-    - bar(a) foo(b); foo(c)
-    ?       ^^^^
-    + bar(a); bar(b); foo(c)
-    ?       ^^^^^
-    ...
+executed test.
 
 It also allows filtering what tests will be executed via ``-k`` parameter.
 
-- 
2.52.0
Re: [Intel-wired-lan] [PATCH v2 23/25] tools/lib/python/unittest_helper.py
Posted by Jacob Keller 1 week, 3 days ago

On 1/28/2026 8:50 AM, Mauro Carvalho Chehab wrote:
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---

What is this patch trying to do? the title is not descriptive, and its 
contents don't make sense.

>   tools/lib/python/unittest_helper.py | 16 +---------------
>   1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/tools/lib/python/unittest_helper.py b/tools/lib/python/unittest_helper.py
> index e438472fa704..3cf1075b1de4 100755
> --- a/tools/lib/python/unittest_helper.py
> +++ b/tools/lib/python/unittest_helper.py
> @@ -8,21 +8,7 @@
>   Helper class to better display unittest results.
>   
>   Those help functions provide a nice colored output summary of each
> -executed test and, when a test fails, it shows the different in diff
> -format when running in verbose mode, like::
> -
> -    $ tools/unittests/nested_match.py -v
> -    ...
> -    Traceback (most recent call last):
> -    File "/new_devel/docs/tools/unittests/nested_match.py", line 69, in test_count_limit
> -        self.assertEqual(replaced, "bar(a); bar(b); foo(c)")
> -        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> -    AssertionError: 'bar(a) foo(b); foo(c)' != 'bar(a); bar(b); foo(c)'
> -    - bar(a) foo(b); foo(c)
> -    ?       ^^^^
> -    + bar(a); bar(b); foo(c)
> -    ?       ^^^^^
> -    ...
> +executed test.
>   

You delete a bunch of the output here, but don't explain why. If this 
part of the doc is no longer valid this should be squashed into whatever 
patch made it invalid. I suspect this is the result of the new wrapper 
you added?

Thanks,
Jake

>   It also allows filtering what tests will be executed via ``-k`` parameter.
>
Re: [Intel-wired-lan] [PATCH v2 23/25] tools/lib/python/unittest_helper.py
Posted by Mauro Carvalho Chehab 1 week, 3 days ago
Hi Jacob,

On Wed, 28 Jan 2026 10:09:18 -0800
Jacob Keller <jacob.e.keller@intel.com> wrote:

> On 1/28/2026 8:50 AM, Mauro Carvalho Chehab wrote:
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > ---  
> 
> What is this patch trying to do? the title is not descriptive, and its 
> contents don't make sense.
> 
> >   tools/lib/python/unittest_helper.py | 16 +---------------
> >   1 file changed, 1 insertion(+), 15 deletions(-)
> > 
> > diff --git a/tools/lib/python/unittest_helper.py b/tools/lib/python/unittest_helper.py
> > index e438472fa704..3cf1075b1de4 100755
> > --- a/tools/lib/python/unittest_helper.py
> > +++ b/tools/lib/python/unittest_helper.py
> > @@ -8,21 +8,7 @@
> >   Helper class to better display unittest results.
> >   
> >   Those help functions provide a nice colored output summary of each
> > -executed test and, when a test fails, it shows the different in diff
> > -format when running in verbose mode, like::
> > -
> > -    $ tools/unittests/nested_match.py -v
> > -    ...
> > -    Traceback (most recent call last):
> > -    File "/new_devel/docs/tools/unittests/nested_match.py", line 69, in test_count_limit
> > -        self.assertEqual(replaced, "bar(a); bar(b); foo(c)")
> > -        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > -    AssertionError: 'bar(a) foo(b); foo(c)' != 'bar(a); bar(b); foo(c)'
> > -    - bar(a) foo(b); foo(c)
> > -    ?       ^^^^
> > -    + bar(a); bar(b); foo(c)
> > -    ?       ^^^^^
> > -    ...
> > +executed test.
> >     
> 
> You delete a bunch of the output here, but don't explain why. If this 
> part of the doc is no longer valid this should be squashed into whatever 
> patch made it invalid. I suspect this is the result of the new wrapper 
> you added?

This patch came from a tool I wrote about one year ago for my own
personal usage. 

It was meant to be merged with patch 21/25, as it cleans up
the module description. I ended removing a function that was
requiring:

	from difflib import unified_diff

as it was unused, but, a second look at it, I guess we can just
drop this patch, as this is plain unittest output.

Anyway, I'll handle it either way at the next version.

Thanks,
Mauro
Re: [Intel-wired-lan] [PATCH v2 23/25] tools/lib/python/unittest_helper.py
Posted by Jacob Keller 1 week, 3 days ago

On 1/28/2026 1:02 PM, Mauro Carvalho Chehab wrote:
> Anyway, I'll handle it either way at the next version.
> 

I also saw you had replied already.. but I hadn't gotten that far in the 
thread yet when reviewing :) Thanks!

> Thanks,
> Mauro
RE: [Intel-wired-lan] [PATCH v2 23/25] tools/lib/python/unittest_helper.py
Posted by Loktionov, Aleksandr 1 week, 3 days ago

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Mauro Carvalho Chehab
> Sent: Wednesday, January 28, 2026 5:50 PM
> To: Jonathan Corbet <corbet@lwn.net>; Linux Doc Mailing List <linux-
> doc@vger.kernel.org>; Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>;
> bpf@vger.kernel.org; intel-wired-lan@lists.osuosl.org; linux-
> kernel@vger.kernel.org; netdev@vger.kernel.org; Peter Zijlstra
> <peterz@infradead.org>; Randy Dunlap <rdunlap@infradead.org>; Shuah
> Khan <skhan@linuxfoundation.org>; Stephen Rothwell
> <sfr@canb.auug.org.au>
> Subject: [Intel-wired-lan] [PATCH v2 23/25]
> tools/lib/python/unittest_helper.py
> 
Could be nice if you add proper commit title following subsystem: brief description format

> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>  tools/lib/python/unittest_helper.py | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/tools/lib/python/unittest_helper.py
> b/tools/lib/python/unittest_helper.py
> index e438472fa704..3cf1075b1de4 100755
> --- a/tools/lib/python/unittest_helper.py
> +++ b/tools/lib/python/unittest_helper.py
> @@ -8,21 +8,7 @@
>  Helper class to better display unittest results.
> 
>  Those help functions provide a nice colored output summary of each -
> executed test and, when a test fails, it shows the different in diff -
> format when running in verbose mode, like::
> -
> -    $ tools/unittests/nested_match.py -v
> -    ...
> -    Traceback (most recent call last):
> -    File "/new_devel/docs/tools/unittests/nested_match.py", line 69,
> in test_count_limit
> -        self.assertEqual(replaced, "bar(a); bar(b); foo(c)")
> -        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> -    AssertionError: 'bar(a) foo(b); foo(c)' != 'bar(a); bar(b);
> foo(c)'
> -    - bar(a) foo(b); foo(c)
> -    ?       ^^^^
> -    + bar(a); bar(b); foo(c)
> -    ?       ^^^^^
> -    ...
> +executed test.
> 
>  It also allows filtering what tests will be executed via ``-k``
> parameter.
> 
> --
> 2.52.0

Re: [PATCH v2 23/25] tools/lib/python/unittest_helper.py
Posted by Mauro Carvalho Chehab 1 week, 3 days ago
On Wed, 28 Jan 2026 17:50:21 +0100
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:

> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

This is obviously wrong... it should have been merged with patch 21, after
a cleanup I did on it to remove some dead code.

> ---
>  tools/lib/python/unittest_helper.py | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/tools/lib/python/unittest_helper.py b/tools/lib/python/unittest_helper.py
> index e438472fa704..3cf1075b1de4 100755
> --- a/tools/lib/python/unittest_helper.py
> +++ b/tools/lib/python/unittest_helper.py
> @@ -8,21 +8,7 @@
>  Helper class to better display unittest results.
>  
>  Those help functions provide a nice colored output summary of each
> -executed test and, when a test fails, it shows the different in diff
> -format when running in verbose mode, like::
> -
> -    $ tools/unittests/nested_match.py -v
> -    ...
> -    Traceback (most recent call last):
> -    File "/new_devel/docs/tools/unittests/nested_match.py", line 69, in test_count_limit
> -        self.assertEqual(replaced, "bar(a); bar(b); foo(c)")
> -        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> -    AssertionError: 'bar(a) foo(b); foo(c)' != 'bar(a); bar(b); foo(c)'
> -    - bar(a) foo(b); foo(c)
> -    ?       ^^^^
> -    + bar(a); bar(b); foo(c)
> -    ?       ^^^^^
> -    ...
> +executed test.
>  
>  It also allows filtering what tests will be executed via ``-k`` parameter.
>  



Thanks,
Mauro