[Patchew-devel] [PATCH 01/10] testing: Avoid masking out outter iterator r

Fam Zheng posted 10 patches 7 years, 6 months ago
There is a newer version of this series
[Patchew-devel] [PATCH 01/10] testing: Avoid masking out outter iterator r
Posted by Fam Zheng 7 years, 6 months ago
The 'r' we want to yield is the object in queryset. Avoid overwriting it
with a requirement string.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 mods/testing.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mods/testing.py b/mods/testing.py
index 0a80b3d..70b4674 100644
--- a/mods/testing.py
+++ b/mods/testing.py
@@ -409,8 +409,8 @@ class TestingGetView(APILoginRequiredView):
             if not t:
                 continue
             reqs = t.get("requirements", "")
-            for r in [x.strip() for x in reqs.split(",") if x]:
-                if r not in capabilities:
+            for req in [x.strip() for x in reqs.split(",") if x]:
+                if req not in capabilities:
                     break
             else:
                 yield r, t
-- 
2.17.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
Re: [Patchew-devel] [PATCH 01/10] testing: Avoid masking out outter iterator r
Posted by Paolo Bonzini 7 years, 6 months ago
On 26/07/2018 03:47, Fam Zheng wrote:
> The 'r' we want to yield is the object in queryset. Avoid overwriting it
> with a requirement string.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  mods/testing.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Did the unit tests miss this, because they never use requirements?

Thanks,

Paolo

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
Re: [Patchew-devel] [PATCH 01/10] testing: Avoid masking out outter iterator r
Posted by Fam Zheng 7 years, 6 months ago
On Thu, Jul 26, 2018 at 4:23 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 26/07/2018 03:47, Fam Zheng wrote:
> > The 'r' we want to yield is the object in queryset. Avoid overwriting it
> > with a requirement string.
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  mods/testing.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Did the unit tests miss this, because they never use requirements?

Good point! Will improve tests.

Fam

>
> Thanks,
>
> Paolo

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel