[PATCH] tests/functional/x86_64/test_virtio_balloon: Fix cosmetic issues from pylint

Thomas Huth posted 1 patch 2 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251029075342.47335-1-thuth@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, David Hildenbrand <david@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Zhao Liu <zhao1.liu@intel.com>
tests/functional/x86_64/test_virtio_balloon.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] tests/functional/x86_64/test_virtio_balloon: Fix cosmetic issues from pylint
Posted by Thomas Huth 2 weeks, 2 days ago
From: Thomas Huth <thuth@redhat.com>

Pylint complains about some style issues in this file: Unused variables
should be marked with an underscore, "when > then and when < now"
can be simplified to "now > when > then" and expectData doesn't conform
to the usual snake_case naming style.

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

diff --git a/tests/functional/x86_64/test_virtio_balloon.py b/tests/functional/x86_64/test_virtio_balloon.py
index 5877b6c408c..7a579e0d69a 100755
--- a/tests/functional/x86_64/test_virtio_balloon.py
+++ b/tests/functional/x86_64/test_virtio_balloon.py
@@ -66,7 +66,7 @@ def assert_initial_stats(self):
         when = ret.get('last-update')
         assert when == 0
         stats = ret.get('stats')
-        for name, val in stats.items():
+        for _name, val in stats.items():
             assert val == UNSET_STATS_VALUE
 
     def assert_running_stats(self, then):
@@ -87,10 +87,10 @@ def assert_running_stats(self, then):
 
         now = time.time()
 
-        assert when > then and when < now
+        assert now > when > then
         stats = ret.get('stats')
         # Stat we expect this particular Kernel to have set
-        expectData = [
+        expect_data = [
             "stat-available-memory",
             "stat-disk-caches",
             "stat-free-memory",
@@ -103,7 +103,7 @@ def assert_running_stats(self, then):
             "stat-total-memory",
         ]
         for name, val in stats.items():
-            if name in expectData:
+            if name in expect_data:
                 assert val != UNSET_STATS_VALUE
             else:
                 assert val == UNSET_STATS_VALUE
-- 
2.51.0
Re: [PATCH] tests/functional/x86_64/test_virtio_balloon: Fix cosmetic issues from pylint
Posted by Zhao Liu 2 weeks, 2 days ago
On Wed, Oct 29, 2025 at 08:53:42AM +0100, Thomas Huth wrote:
> Date: Wed, 29 Oct 2025 08:53:42 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: [PATCH] tests/functional/x86_64/test_virtio_balloon: Fix cosmetic
>  issues from pylint
> 
> From: Thomas Huth <thuth@redhat.com>
> 
> Pylint complains about some style issues in this file: Unused variables
> should be marked with an underscore, "when > then and when < now"
> can be simplified to "now > when > then" and expectData doesn't conform
> to the usual snake_case naming style.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/functional/x86_64/test_virtio_balloon.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

LGTM,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Re: [PATCH] tests/functional/x86_64/test_virtio_balloon: Fix cosmetic issues from pylint
Posted by Manos Pitsidianakis 2 weeks, 2 days ago
On Wed, Oct 29, 2025 at 9:54 AM Thomas Huth <thuth@redhat.com> wrote:
>
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint complains about some style issues in this file: Unused variables
> should be marked with an underscore, "when > then and when < now"
> can be simplified to "now > when > then" and expectData doesn't conform
> to the usual snake_case naming style.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

>  tests/functional/x86_64/test_virtio_balloon.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tests/functional/x86_64/test_virtio_balloon.py b/tests/functional/x86_64/test_virtio_balloon.py
> index 5877b6c408c..7a579e0d69a 100755
> --- a/tests/functional/x86_64/test_virtio_balloon.py
> +++ b/tests/functional/x86_64/test_virtio_balloon.py
> @@ -66,7 +66,7 @@ def assert_initial_stats(self):
>          when = ret.get('last-update')
>          assert when == 0
>          stats = ret.get('stats')
> -        for name, val in stats.items():
> +        for _name, val in stats.items():
>              assert val == UNSET_STATS_VALUE
>
>      def assert_running_stats(self, then):
> @@ -87,10 +87,10 @@ def assert_running_stats(self, then):
>
>          now = time.time()
>
> -        assert when > then and when < now
> +        assert now > when > then
>          stats = ret.get('stats')
>          # Stat we expect this particular Kernel to have set
> -        expectData = [
> +        expect_data = [
>              "stat-available-memory",
>              "stat-disk-caches",
>              "stat-free-memory",
> @@ -103,7 +103,7 @@ def assert_running_stats(self, then):
>              "stat-total-memory",
>          ]
>          for name, val in stats.items():
> -            if name in expectData:
> +            if name in expect_data:
>                  assert val != UNSET_STATS_VALUE
>              else:
>                  assert val == UNSET_STATS_VALUE
> --
> 2.51.0
>
>