summary refs log tree commit diff stats
path: root/tests/functional/qemu_test/__init__.py
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2024-12-17 15:59:28 +0000
committerThomas Huth <thuth@redhat.com>2024-12-17 19:39:53 +0100
commit3ea06d65be5ee65beabc479d92e964e3c9df5080 (patch)
tree8d10a16ce57538b67f7e20602507ada5d7f1eafa /tests/functional/qemu_test/__init__.py
parentc54edc71093bf85550245250d1f5922465848e83 (diff)
downloadfocaccia-qemu-3ea06d65be5ee65beabc479d92e964e3c9df5080.tar.gz
focaccia-qemu-3ea06d65be5ee65beabc479d92e964e3c9df5080.zip
tests/functional: introduce some helpful decorators
Reduce repeated boilerplate with some helper decorators:

 @skipIfNotPlatform("x86_64", "aarch64")

  => Skip unless the build host platform matches

 @skipIfMissingCommands("mkisofs", "losetup")

  => Skips unless all listed commands are found in $PATH

 @skipIfMissingImports("numpy", "cv2")

  => Skips unless all listed modules can be imported

 @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/issues/NNN")

  => Skips unless env var requests flaky tests with the
     reason documented in the referenced gitlab bug

 @skipBigData

  => Skips unless env var permits tests creating big data files

 @skipUntrustedTest

  => Skips unless env var permits tests which are potentially
     dangerous to the host

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20241217155953.3950506-8-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/functional/qemu_test/__init__.py')
-rw-r--r--tests/functional/qemu_test/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
index 8fddddbe67..7dee3522f2 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -13,3 +13,6 @@ from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \
     exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
 from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
 from .linuxkernel import LinuxKernelTest
+from .decorators import skipIfMissingCommands, skipIfNotMachine, \
+    skipFlakyTest, skipUntrustedTest, skipBigDataTest, \
+    skipIfMissingImports