public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set
@ 2016-10-16 18:17 Stefan Brüns
  2016-10-17 18:11 ` Stephen Warren
  2016-10-17 22:59 ` Stephen Warren
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Brüns @ 2016-10-16 18:17 UTC (permalink / raw)
  To: u-boot

If the parameter set is empty, the pytest setup fails:
---
    call: <CallInfo when='setup' exception: got empty parameter set
    ['env__dfu_config'], function test_dfu@[...]test_dfu.py:107>
---

This aborts pytest_runtest_makereport and later leads to an exception
during the report generation, as the call to log.start_section(...)
is never executed:
---
    Exception: Block nesting mismatch:
    "test_dfu[env__usb_dev_port0-env__dfu_config0]" ""
---

Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
---
 test/py/conftest.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 5b3a923..ebef40d 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -270,6 +270,8 @@ def generate_config(metafunc, fixture_name):
         # ... otherwise, see if there's a key that contains a list of
         # values to use instead.
         vals = subconfig.get(fixture_name+ 's', [])
+    if len(vals) == 0:
+        return
     def fixture_id(index, val):
         try:
             return val['fixture_id']
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set
  2016-10-16 18:17 [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set Stefan Brüns
@ 2016-10-17 18:11 ` Stephen Warren
  2016-10-17 19:18   ` Brüns, Stefan
  2016-10-17 22:59 ` Stephen Warren
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2016-10-17 18:11 UTC (permalink / raw)
  To: u-boot

On 10/16/2016 12:17 PM, Stefan Br?ns wrote:
> If the parameter set is empty, the pytest setup fails:
> ---
>     call: <CallInfo when='setup' exception: got empty parameter set
>     ['env__dfu_config'], function test_dfu at [...]test_dfu.py:107>
> ---
>
> This aborts pytest_runtest_makereport and later leads to an exception
> during the report generation, as the call to log.start_section(...)
> is never executed:
> ---
>     Exception: Block nesting mismatch:
>     "test_dfu[env__usb_dev_port0-env__dfu_config0]" ""
> ---

How do you trigger this? I believe my test setup has many cases where 
the test you added would trigger, but without the issues you mention, 
but I'm not 100% sure since I don't know for sure what is causing this 
issue.

Which pytest version do you have? I appear to have 2.5.1 (on Ubuntu Trusty)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set
  2016-10-17 18:11 ` Stephen Warren
@ 2016-10-17 19:18   ` Brüns, Stefan
  2016-10-17 22:01     ` Stephen Warren
  0 siblings, 1 reply; 6+ messages in thread
From: Brüns, Stefan @ 2016-10-17 19:18 UTC (permalink / raw)
  To: u-boot

On Montag, 17. Oktober 2016 12:11:26 CEST Stephen Warren wrote:
> On 10/16/2016 12:17 PM, Stefan Br?ns wrote:
> > If the parameter set is empty, the pytest setup fails:
> > ---
> > 
> >     call: <CallInfo when='setup' exception: got empty parameter set
> >     ['env__dfu_config'], function test_dfu at [...]test_dfu.py:107>
> > 
> > ---
> > 
> > This aborts pytest_runtest_makereport and later leads to an exception
> > during the report generation, as the call to log.start_section(...)
> > is never executed:
> > ---
> > 
> >     Exception: Block nesting mismatch:
> >     "test_dfu[env__usb_dev_port0-env__dfu_config0]" ""
> > 
> > ---
> 
> How do you trigger this? I believe my test setup has many cases where
> the test you added would trigger, but without the issues you mention,
> but I'm not 100% sure since I don't know for sure what is causing this
> issue.
> 
> Which pytest version do you have? I appear to have 2.5.1 (on Ubuntu Trusty)

1. You need "dfu_configs" to be empty
2. Maybe its pytest version dependent, IIRC I have 3.0.2

The first error above can be seen when running pytest with "--debug", it is 
written to IIRC pytestdebug.log

Kind regards,

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set
  2016-10-17 19:18   ` Brüns, Stefan
@ 2016-10-17 22:01     ` Stephen Warren
  2016-10-17 22:21       ` Stephen Warren
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2016-10-17 22:01 UTC (permalink / raw)
  To: u-boot

On 10/17/2016 01:18 PM, Br?ns, Stefan wrote:
> On Montag, 17. Oktober 2016 12:11:26 CEST Stephen Warren wrote:
>> On 10/16/2016 12:17 PM, Stefan Br?ns wrote:
>>> If the parameter set is empty, the pytest setup fails:
>>> ---
>>>
>>>     call: <CallInfo when='setup' exception: got empty parameter set
>>>     ['env__dfu_config'], function test_dfu at [...]test_dfu.py:107>
>>>
>>> ---
>>>
>>> This aborts pytest_runtest_makereport and later leads to an exception
>>> during the report generation, as the call to log.start_section(...)
>>> is never executed:
>>> ---
>>>
>>>     Exception: Block nesting mismatch:
>>>     "test_dfu[env__usb_dev_port0-env__dfu_config0]" ""
>>>
>>> ---
>>
>> How do you trigger this? I believe my test setup has many cases where
>> the test you added would trigger, but without the issues you mention,
>> but I'm not 100% sure since I don't know for sure what is causing this
>> issue.
>>
>> Which pytest version do you have? I appear to have 2.5.1 (on Ubuntu Trusty)
>
> 1. You need "dfu_configs" to be empty
> 2. Maybe its pytest version dependent, IIRC I have 3.0.2
>
> The first error above can be seen when running pytest with "--debug", it is
> written to IIRC pytestdebug.log

Looks like this is a bug in pytest 3, and has been fixed upstream:

https://github.com/pytest-dev/pytest/issues/1849
Pytest 3.0 does not accept empty list in fixture

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set
  2016-10-17 22:01     ` Stephen Warren
@ 2016-10-17 22:21       ` Stephen Warren
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2016-10-17 22:21 UTC (permalink / raw)
  To: u-boot

On 10/17/2016 04:01 PM, Stephen Warren wrote:
> On 10/17/2016 01:18 PM, Br?ns, Stefan wrote:
>> On Montag, 17. Oktober 2016 12:11:26 CEST Stephen Warren wrote:
>>> On 10/16/2016 12:17 PM, Stefan Br?ns wrote:
>>>> If the parameter set is empty, the pytest setup fails:
>>>> ---
>>>>
>>>>     call: <CallInfo when='setup' exception: got empty parameter set
>>>>     ['env__dfu_config'], function test_dfu at [...]test_dfu.py:107>
>>>>
>>>> ---
>>>>
>>>> This aborts pytest_runtest_makereport and later leads to an exception
>>>> during the report generation, as the call to log.start_section(...)
>>>> is never executed:
>>>> ---
>>>>
>>>>     Exception: Block nesting mismatch:
>>>>     "test_dfu[env__usb_dev_port0-env__dfu_config0]" ""
>>>>
>>>> ---
>>>
>>> How do you trigger this? I believe my test setup has many cases where
>>> the test you added would trigger, but without the issues you mention,
>>> but I'm not 100% sure since I don't know for sure what is causing this
>>> issue.
>>>
>>> Which pytest version do you have? I appear to have 2.5.1 (on Ubuntu
>>> Trusty)
>>
>> 1. You need "dfu_configs" to be empty
>> 2. Maybe its pytest version dependent, IIRC I have 3.0.2
>>
>> The first error above can be seen when running pytest with "--debug",
>> it is
>> written to IIRC pytestdebug.log
>
> Looks like this is a bug in pytest 3, and has been fixed upstream:
>
> https://github.com/pytest-dev/pytest/issues/1849
> Pytest 3.0 does not accept empty list in fixture

Actually, I take that back; that's something else. I'll keep looking.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set
  2016-10-16 18:17 [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set Stefan Brüns
  2016-10-17 18:11 ` Stephen Warren
@ 2016-10-17 22:59 ` Stephen Warren
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2016-10-17 22:59 UTC (permalink / raw)
  To: u-boot

On 10/16/2016 12:17 PM, Stefan Br?ns wrote:
> If the parameter set is empty, the pytest setup fails:
> ---
>     call: <CallInfo when='setup' exception: got empty parameter set
>     ['env__dfu_config'], function test_dfu at [...]test_dfu.py:107>
> ---
>
> This aborts pytest_runtest_makereport and later leads to an exception
> during the report generation, as the call to log.start_section(...)
> is never executed:
> ---
>     Exception: Block nesting mismatch:
>     "test_dfu[env__usb_dev_port0-env__dfu_config0]" ""
> ---

This patch causes failures with pytest 2.5 when env__dfu_configs is an 
empty list or not set at all. I've created an alternative patch that 
seems to work with both pytest 2.5 and 3, which I'll send in a minute.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-17 22:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-16 18:17 [U-Boot] [PATCH] test/py: Fix exception, do not parametrize with empty set Stefan Brüns
2016-10-17 18:11 ` Stephen Warren
2016-10-17 19:18   ` Brüns, Stefan
2016-10-17 22:01     ` Stephen Warren
2016-10-17 22:21       ` Stephen Warren
2016-10-17 22:59 ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox