All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] test: avoid function name 'setup'
@ 2023-07-15  9:05 Heinrich Schuchardt
  2023-07-15 23:40 ` Simon Glass
  2023-07-25 21:13 ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-07-15  9:05 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Simon Glass, Masahisa Kojima, u-boot, Heinrich Schuchardt

pytest 7.3.2 treats the function name 'setup' as a fixture [1].

This leads to errors like:

    TypeError: setup() missing 2 required positional arguments:
    'disk_img' and 'osindications'

Rename setup() to capsule_setup().

[1] How to run tests written for nose
    https://docs.pytest.org/en/7.3.x/how-to/nose.html

Fixes: 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 test/py/tests/test_efi_capsule/capsule_common.py     |  2 +-
 .../test_efi_capsule/test_capsule_firmware_fit.py    | 10 +++++-----
 .../test_efi_capsule/test_capsule_firmware_raw.py    | 12 ++++++------
 .../test_capsule_firmware_signed_fit.py              | 12 ++++++------
 .../test_capsule_firmware_signed_raw.py              | 12 ++++++------
 5 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/test/py/tests/test_efi_capsule/capsule_common.py b/test/py/tests/test_efi_capsule/capsule_common.py
index 9eef6767a6..fc0d851c61 100644
--- a/test/py/tests/test_efi_capsule/capsule_common.py
+++ b/test/py/tests/test_efi_capsule/capsule_common.py
@@ -6,7 +6,7 @@
 
 from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR
 
-def setup(u_boot_console, disk_img, osindications):
+def capsule_setup(u_boot_console, disk_img, osindications):
     """setup the test
 
     Args:
diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py
index a3094c33f4..11bcdc2bb2 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py
@@ -8,7 +8,7 @@ This test verifies capsule-on-disk firmware update for FIT images
 
 import pytest
 from capsule_common import (
-    setup,
+    capsule_setup,
     init_content,
     place_capsule_file,
     exec_manual_update,
@@ -49,7 +49,7 @@ class TestEfiCapsuleFirmwareFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test05']
         with u_boot_console.log.section('Test Case 1-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             init_content(u_boot_console, '150000', 'u-boot.env.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
@@ -81,7 +81,7 @@ class TestEfiCapsuleFirmwareFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test04']
         with u_boot_console.log.section('Test Case 2-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             init_content(u_boot_console, '150000', 'u-boot.env.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
@@ -116,7 +116,7 @@ class TestEfiCapsuleFirmwareFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test104']
         with u_boot_console.log.section('Test Case 3-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             init_content(u_boot_console, '150000', 'u-boot.env.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
@@ -165,7 +165,7 @@ class TestEfiCapsuleFirmwareFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test105']
         with u_boot_console.log.section('Test Case 4-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py
index 80d791e3de..a5b5c8a385 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py
@@ -8,7 +8,7 @@ This test verifies capsule-on-disk firmware update for raw images
 
 import pytest
 from capsule_common import (
-    setup,
+    capsule_setup,
     init_content,
     place_capsule_file,
     exec_manual_update,
@@ -51,7 +51,7 @@ class TestEfiCapsuleFirmwareRaw:
         disk_img = efi_capsule_data
         capsule_files = ['Test03']
         with u_boot_console.log.section('Test Case 1-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             init_content(u_boot_console, '150000', 'u-boot.env.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
@@ -83,7 +83,7 @@ class TestEfiCapsuleFirmwareRaw:
         disk_img = efi_capsule_data
         capsule_files = ['Test01', 'Test02']
         with u_boot_console.log.section('Test Case 2-a, before reboot'):
-            setup(u_boot_console, disk_img, None)
+            capsule_setup(u_boot_console, disk_img, None)
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             init_content(u_boot_console, '150000', 'u-boot.env.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
@@ -111,7 +111,7 @@ class TestEfiCapsuleFirmwareRaw:
         disk_img = efi_capsule_data
         capsule_files = ['Test01', 'Test02']
         with u_boot_console.log.section('Test Case 3-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             init_content(u_boot_console, '150000', 'u-boot.env.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
@@ -157,7 +157,7 @@ class TestEfiCapsuleFirmwareRaw:
         disk_img = efi_capsule_data
         capsule_files = ['Test101', 'Test102']
         with u_boot_console.log.section('Test Case 4-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             init_content(u_boot_console, '150000', 'u-boot.env.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
@@ -211,7 +211,7 @@ class TestEfiCapsuleFirmwareRaw:
         disk_img = efi_capsule_data
         capsule_files = ['Test103']
         with u_boot_console.log.section('Test Case 5-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py
index 94d6c3eef0..44a58baa31 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_fit.py
@@ -11,7 +11,7 @@ with signed capsule files containing FIT images
 
 import pytest
 from capsule_common import (
-    setup,
+    capsule_setup,
     init_content,
     place_capsule_file,
     exec_manual_update,
@@ -47,7 +47,7 @@ class TestEfiCapsuleFirmwareSignedFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test13']
         with u_boot_console.log.section('Test Case 1-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -76,7 +76,7 @@ class TestEfiCapsuleFirmwareSignedFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test14']
         with u_boot_console.log.section('Test Case 2-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -107,7 +107,7 @@ class TestEfiCapsuleFirmwareSignedFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test02']
         with u_boot_console.log.section('Test Case 3-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -137,7 +137,7 @@ class TestEfiCapsuleFirmwareSignedFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test114']
         with u_boot_console.log.section('Test Case 4-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -176,7 +176,7 @@ class TestEfiCapsuleFirmwareSignedFit():
         disk_img = efi_capsule_data
         capsule_files = ['Test115']
         with u_boot_console.log.section('Test Case 5-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py
index ad2b1c6324..83a10e160b 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_signed_raw.py
@@ -9,7 +9,7 @@ with signed capsule files containing raw images
 
 import pytest
 from capsule_common import (
-    setup,
+    capsule_setup,
     init_content,
     place_capsule_file,
     exec_manual_update,
@@ -44,7 +44,7 @@ class TestEfiCapsuleFirmwareSignedRaw():
         disk_img = efi_capsule_data
         capsule_files =  ['Test11']
         with u_boot_console.log.section('Test Case 1-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -72,7 +72,7 @@ class TestEfiCapsuleFirmwareSignedRaw():
         disk_img = efi_capsule_data
         capsule_files = ['Test12']
         with u_boot_console.log.section('Test Case 2-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -101,7 +101,7 @@ class TestEfiCapsuleFirmwareSignedRaw():
         disk_img = efi_capsule_data
         capsule_files = ['Test02']
         with u_boot_console.log.section('Test Case 3-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -131,7 +131,7 @@ class TestEfiCapsuleFirmwareSignedRaw():
         disk_img = efi_capsule_data
         capsule_files = ['Test111', 'Test112']
         with u_boot_console.log.section('Test Case 4-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
@@ -175,7 +175,7 @@ class TestEfiCapsuleFirmwareSignedRaw():
         disk_img = efi_capsule_data
         capsule_files = ['Test113']
         with u_boot_console.log.section('Test Case 5-a, before reboot'):
-            setup(u_boot_console, disk_img, '0x0000000000000004')
+            capsule_setup(u_boot_console, disk_img, '0x0000000000000004')
             init_content(u_boot_console, '100000', 'u-boot.bin.old', 'Old')
             place_capsule_file(u_boot_console, capsule_files)
 
-- 
2.40.1


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

* Re: [PATCH 1/1] test: avoid function name 'setup'
  2023-07-15  9:05 [PATCH 1/1] test: avoid function name 'setup' Heinrich Schuchardt
@ 2023-07-15 23:40 ` Simon Glass
  2023-07-16 13:37   ` Heinrich Schuchardt
  2023-07-25 21:13 ` Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Glass @ 2023-07-15 23:40 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Ilias Apalodimas, Masahisa Kojima, u-boot

Hi Heinrich,

On Sat, 15 Jul 2023 at 03:05, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> pytest 7.3.2 treats the function name 'setup' as a fixture [1].
>
> This leads to errors like:
>
>     TypeError: setup() missing 2 required positional arguments:
>     'disk_img' and 'osindications'
>
> Rename setup() to capsule_setup().
>
> [1] How to run tests written for nose
>     https://docs.pytest.org/en/7.3.x/how-to/nose.html
>
> Fixes: 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  test/py/tests/test_efi_capsule/capsule_common.py     |  2 +-
>  .../test_efi_capsule/test_capsule_firmware_fit.py    | 10 +++++-----
>  .../test_efi_capsule/test_capsule_firmware_raw.py    | 12 ++++++------
>  .../test_capsule_firmware_signed_fit.py              | 12 ++++++------
>  .../test_capsule_firmware_signed_raw.py              | 12 ++++++------
>  5 files changed, 24 insertions(+), 24 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Would it make sense to reduce the code duplication a little?

Regards,
SImon

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

* Re: [PATCH 1/1] test: avoid function name 'setup'
  2023-07-15 23:40 ` Simon Glass
@ 2023-07-16 13:37   ` Heinrich Schuchardt
  2023-07-24 13:58     ` Ilias Apalodimas
  0 siblings, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-07-16 13:37 UTC (permalink / raw)
  To: Simon Glass; +Cc: Ilias Apalodimas, Masahisa Kojima, u-boot



On 7/16/23 01:40, Simon Glass wrote:
> Hi Heinrich,
> 
> On Sat, 15 Jul 2023 at 03:05, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> pytest 7.3.2 treats the function name 'setup' as a fixture [1].
>>
>> This leads to errors like:
>>
>>      TypeError: setup() missing 2 required positional arguments:
>>      'disk_img' and 'osindications'
>>
>> Rename setup() to capsule_setup().
>>
>> [1] How to run tests written for nose
>>      https://docs.pytest.org/en/7.3.x/how-to/nose.html
>>
>> Fixes: 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test")
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>>   test/py/tests/test_efi_capsule/capsule_common.py     |  2 +-
>>   .../test_efi_capsule/test_capsule_firmware_fit.py    | 10 +++++-----
>>   .../test_efi_capsule/test_capsule_firmware_raw.py    | 12 ++++++------
>>   .../test_capsule_firmware_signed_fit.py              | 12 ++++++------
>>   .../test_capsule_firmware_signed_raw.py              | 12 ++++++------
>>   5 files changed, 24 insertions(+), 24 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Would it make sense to reduce the code duplication a little?

Thank you for reviewing.

Fixed 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test")
started the de-duplication effort.

Best regards

Heinrich

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

* Re: [PATCH 1/1] test: avoid function name 'setup'
  2023-07-16 13:37   ` Heinrich Schuchardt
@ 2023-07-24 13:58     ` Ilias Apalodimas
  0 siblings, 0 replies; 5+ messages in thread
From: Ilias Apalodimas @ 2023-07-24 13:58 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Simon Glass, Masahisa Kojima, u-boot

On Sun, 16 Jul 2023 at 16:37, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
>
>
> On 7/16/23 01:40, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Sat, 15 Jul 2023 at 03:05, Heinrich Schuchardt
> > <heinrich.schuchardt@canonical.com> wrote:
> >>
> >> pytest 7.3.2 treats the function name 'setup' as a fixture [1].
> >>
> >> This leads to errors like:
> >>
> >>      TypeError: setup() missing 2 required positional arguments:
> >>      'disk_img' and 'osindications'
> >>
> >> Rename setup() to capsule_setup().
> >>
> >> [1] How to run tests written for nose
> >>      https://docs.pytest.org/en/7.3.x/how-to/nose.html
> >>
> >> Fixes: 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test")
> >> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> >> ---
> >>   test/py/tests/test_efi_capsule/capsule_common.py     |  2 +-
> >>   .../test_efi_capsule/test_capsule_firmware_fit.py    | 10 +++++-----
> >>   .../test_efi_capsule/test_capsule_firmware_raw.py    | 12 ++++++------
> >>   .../test_capsule_firmware_signed_fit.py              | 12 ++++++------
> >>   .../test_capsule_firmware_signed_raw.py              | 12 ++++++------
> >>   5 files changed, 24 insertions(+), 24 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > Would it make sense to reduce the code duplication a little?
>
> Thank you for reviewing.
>
> Fixed 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test")
> started the de-duplication effort.
>
> Best regards
>
> Heinrich

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

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

* Re: [PATCH 1/1] test: avoid function name 'setup'
  2023-07-15  9:05 [PATCH 1/1] test: avoid function name 'setup' Heinrich Schuchardt
  2023-07-15 23:40 ` Simon Glass
@ 2023-07-25 21:13 ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2023-07-25 21:13 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Ilias Apalodimas, Simon Glass, Masahisa Kojima, u-boot

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

On Sat, Jul 15, 2023 at 11:05:22AM +0200, Heinrich Schuchardt wrote:

> pytest 7.3.2 treats the function name 'setup' as a fixture [1].
> 
> This leads to errors like:
> 
>     TypeError: setup() missing 2 required positional arguments:
>     'disk_img' and 'osindications'
> 
> Rename setup() to capsule_setup().
> 
> [1] How to run tests written for nose
>     https://docs.pytest.org/en/7.3.x/how-to/nose.html
> 
> Fixes: 482ef90aeb4c ("test: efi_capsule: refactor efi_capsule test")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2023-07-25 21:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-15  9:05 [PATCH 1/1] test: avoid function name 'setup' Heinrich Schuchardt
2023-07-15 23:40 ` Simon Glass
2023-07-16 13:37   ` Heinrich Schuchardt
2023-07-24 13:58     ` Ilias Apalodimas
2023-07-25 21:13 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.