[PATCH] tests/functional/riscv64: Silence warnings from Pylint in the boston test

Thomas Huth posted 1 patch 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260116095615.269199-1-thuth@redhat.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
tests/functional/riscv64/test_boston.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
[PATCH] tests/functional/riscv64: Silence warnings from Pylint in the boston test
Posted by Thomas Huth 3 weeks ago
From: Thomas Huth <thuth@redhat.com>

Pylint complains:

 tests/functional/riscv64/test_boston.py:1:0: C0114:
  Missing module docstring (missing-module-docstring)
 tests/functional/riscv64/test_boston.py:95:8: C0415:
  Import outside toplevel (subprocess.run, subprocess.PIPE) (import-outside-toplevel)
 tests/functional/riscv64/test_boston.py:112:17: W1510:
  'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
 tests/functional/riscv64/test_boston.py:95:8: W0611:
  Unused PIPE imported from subprocess (unused-import)

Rework the code a little bit to make the linter happy.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/riscv64/test_boston.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/functional/riscv64/test_boston.py b/tests/functional/riscv64/test_boston.py
index 385de6a61df..2582df96f21 100755
--- a/tests/functional/riscv64/test_boston.py
+++ b/tests/functional/riscv64/test_boston.py
@@ -1,11 +1,14 @@
 #!/usr/bin/env python3
 #
-# Boston board test for RISC-V P8700 processor by MIPS
-#
 # Copyright (c) 2025 MIPS
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
 #
+"""
+Boston board test for RISC-V P8700 processor by MIPS
+"""
+
+from subprocess import run
 
 from qemu_test import QemuSystemTest, Asset
 from qemu_test import wait_for_console_pattern
@@ -92,7 +95,6 @@ def test_boston_invalid_cpu_count(self):
         """
         Test that 65 CPUs is rejected as invalid (negative test case)
         """
-        from subprocess import run, PIPE
 
         fw_payload_path = self.ASSET_FW_PAYLOAD.fetch()
         rootfs_path = self.ASSET_ROOTFS.fetch()
@@ -109,7 +111,8 @@ def test_boston_invalid_cpu_count(self):
         ]
 
         # Run QEMU and expect it to fail immediately.
-        result = run(cmd, capture_output=True, text=True, timeout=5)
+        result = run(cmd, capture_output=True, text=True, timeout=5,
+                     check=False)
 
         # Check that QEMU exited with error code 1
         self.assertEqual(result.returncode, 1,
-- 
2.52.0
Re: [PATCH] tests/functional/riscv64: Silence warnings from Pylint in the boston test
Posted by Chao Liu 2 weeks, 3 days ago
Hi Thomas,

On 1/16/2026 5:56 PM, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> Pylint complains:
> 
>  tests/functional/riscv64/test_boston.py:1:0: C0114:
>   Missing module docstring (missing-module-docstring)
>  tests/functional/riscv64/test_boston.py:95:8: C0415:
>   Import outside toplevel (subprocess.run, subprocess.PIPE) (import-outside-toplevel)
>  tests/functional/riscv64/test_boston.py:112:17: W1510:
>   'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
>  tests/functional/riscv64/test_boston.py:95:8: W0611:
>   Unused PIPE imported from subprocess (unused-import)
> 
> Rework the code a little bit to make the linter happy.
> 
I tested this patch, and it works well :)

Tested-by: Chao Liu <chao.liu.zevorn@gmail.com>

> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/functional/riscv64/test_boston.py | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/functional/riscv64/test_boston.py b/tests/functional/riscv64/test_boston.py
> index 385de6a61df..2582df96f21 100755
> --- a/tests/functional/riscv64/test_boston.py
> +++ b/tests/functional/riscv64/test_boston.py
> @@ -1,11 +1,14 @@
>  #!/usr/bin/env python3
>  #
> -# Boston board test for RISC-V P8700 processor by MIPS
> -#
>  # Copyright (c) 2025 MIPS
>  #
>  # SPDX-License-Identifier: GPL-2.0-or-later
>  #
> +"""
> +Boston board test for RISC-V P8700 processor by MIPS
> +"""
> +
> +from subprocess import run
>  
>  from qemu_test import QemuSystemTest, Asset
>  from qemu_test import wait_for_console_pattern
> @@ -92,7 +95,6 @@ def test_boston_invalid_cpu_count(self):
>          """
>          Test that 65 CPUs is rejected as invalid (negative test case)
>          """
> -        from subprocess import run, PIPE
>  
>          fw_payload_path = self.ASSET_FW_PAYLOAD.fetch()
>          rootfs_path = self.ASSET_ROOTFS.fetch()
> @@ -109,7 +111,8 @@ def test_boston_invalid_cpu_count(self):
>          ]
>  
>          # Run QEMU and expect it to fail immediately.
> -        result = run(cmd, capture_output=True, text=True, timeout=5)
> +        result = run(cmd, capture_output=True, text=True, timeout=5,
> +                     check=False)
>  
>          # Check that QEMU exited with error code 1
>          self.assertEqual(result.returncode, 1,
Re: [PATCH] tests/functional/riscv64: Silence warnings from Pylint in the boston test
Posted by Philippe Mathieu-Daudé 3 weeks ago
On 16/1/26 10:56, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> Pylint complains:
> 
>   tests/functional/riscv64/test_boston.py:1:0: C0114:
>    Missing module docstring (missing-module-docstring)
>   tests/functional/riscv64/test_boston.py:95:8: C0415:
>    Import outside toplevel (subprocess.run, subprocess.PIPE) (import-outside-toplevel)
>   tests/functional/riscv64/test_boston.py:112:17: W1510:
>    'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
>   tests/functional/riscv64/test_boston.py:95:8: W0611:
>    Unused PIPE imported from subprocess (unused-import)
> 
> Rework the code a little bit to make the linter happy.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   tests/functional/riscv64/test_boston.py | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>