[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/20] tests/functional/qemu_test/decorators: Fix bad check for im
From: |
Thomas Huth |
Subject: |
[PULL 01/20] tests/functional/qemu_test/decorators: Fix bad check for imports |
Date: |
Thu, 30 Jan 2025 14:15:15 +0100 |
skipIfMissingImports should use importlib.import_module() for checking
whether a module with the name stored in the "impname" variable is
available or not, otherwise the code tries to import a module with
the name "impname" instead.
(This bug hasn't been noticed before since there is another issue
with this decorator that will be fixed by the next patch)
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20250122134315.1448794-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/qemu_test/decorators.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/functional/qemu_test/decorators.py
b/tests/functional/qemu_test/decorators.py
index df088bc090..08f58f6b40 100644
--- a/tests/functional/qemu_test/decorators.py
+++ b/tests/functional/qemu_test/decorators.py
@@ -2,6 +2,7 @@
#
# Decorators useful in functional tests
+import importlib
import os
import platform
from unittest import skipUnless
@@ -97,7 +98,7 @@ def skipIfMissingImports(*args):
def has_imports(importlist):
for impname in importlist:
try:
- import impname
+ importlib.import_module(impname)
except ImportError:
return False
return True
--
2.48.1
- [PULL 00/20] Functional tests, s390x improvements and slirp fixes, Thomas Huth, 2025/01/30
- [PULL 01/20] tests/functional/qemu_test/decorators: Fix bad check for imports,
Thomas Huth <=
- [PULL 03/20] tests/functional: Convert the migration avocado test, Thomas Huth, 2025/01/30
- [PULL 06/20] tests/functional/test_mips_malta: Fix comment about endianness of the test, Thomas Huth, 2025/01/30
- [PULL 02/20] tests/functional: Fix broken decorators with lamda functions, Thomas Huth, 2025/01/30
- [PULL 04/20] tests/functional: Fix the aarch64_tcg_plugins test, Thomas Huth, 2025/01/30
- [PULL 05/20] tests/functional: Add a ppc64 mac99 test, Thomas Huth, 2025/01/30
- [PULL 09/20] tests/tcg/s390x: Test modifying code using the MVC instruction, Thomas Huth, 2025/01/30
- [PULL 14/20] tests/functional: Extend PPC 40p test with Linux boot, Thomas Huth, 2025/01/30
- [PULL 15/20] tests/functional: Add a decorator for skipping long running tests, Thomas Huth, 2025/01/30
- [PULL 16/20] tests/functional: Add the ReplayKernelBase class, Thomas Huth, 2025/01/30
- [PULL 11/20] virtio-balloon-pci: Allow setting nvectors, so we can use MSI-X, Thomas Huth, 2025/01/30