[PATCH 4/4] tests/functional/qemu_test: Silence warnings from pylint in config.py

Thomas Huth posted 4 patches 1 week, 4 days ago
Maintainers: Thomas Huth <th.huth+qemu@posteo.eu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Daniel P. Berrangé" <berrange@redhat.com>
[PATCH 4/4] tests/functional/qemu_test: Silence warnings from pylint in config.py
Posted by Thomas Huth 1 week, 4 days ago
From: Thomas Huth <thuth@redhat.com>

Pylint complains here:

 config.py:1:0: C0114: Missing module docstring (missing-module-docstring)
 config.py:28:4: W0719: Raising too general exception: Exception (broad-exception-raised)

Add a module description and replace the general Exception to fix this.
And while we're at it, and since we've got a proper module description
string now, also replace the copy-n-pasted comment at the top of the file
with a proper SPDX identifier.

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

diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_test/config.py
index e0893f630ee..5d44b6fa4c0 100644
--- a/tests/functional/qemu_test/config.py
+++ b/tests/functional/qemu_test/config.py
@@ -1,4 +1,4 @@
-# Test class and utilities for functional tests
+# SPDX-License-Identifier: GPL-2.0-or-later
 #
 # Copyright 2018, 2024 Red Hat, Inc.
 #
@@ -10,6 +10,9 @@
 #
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
+'''
+Functions related to the configuration of the tests and of the host system
+'''
 
 import os
 from pathlib import Path
@@ -25,9 +28,9 @@ def _build_dir():
     if root is not None:
         return Path(root)
 
-    raise Exception("Missing MESON_BUILD_ROOT environment variable. " +
-                    "Please use the '<BUILD-DIR>/run' script if invoking " +
-                    "directly instead of via make/meson")
+    raise RuntimeError("Missing MESON_BUILD_ROOT environment variable. " +
+                       "Please use the '<BUILD-DIR>/run' script if invoking " +
+                       "directly instead of via make/meson")
 
 BUILD_DIR = _build_dir()
 
-- 
2.53.0
Re: [PATCH 4/4] tests/functional/qemu_test: Silence warnings from pylint in config.py
Posted by Philippe Mathieu-Daudé 1 week, 4 days ago
On 24/3/26 17:35, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> Pylint complains here:
> 
>   config.py:1:0: C0114: Missing module docstring (missing-module-docstring)
>   config.py:28:4: W0719: Raising too general exception: Exception (broad-exception-raised)
> 
> Add a module description and replace the general Exception to fix this.
> And while we're at it, and since we've got a proper module description
> string now, also replace the copy-n-pasted comment at the top of the file
> with a proper SPDX identifier.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   tests/functional/qemu_test/config.py | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)

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