On 3/4/25 20:04, Thomas Huth wrote:
On 03/04/2025 17.18, Philippe Mathieu-Daudé wrote:
Since tests might be failing on some operating systems,
introduce the skipIfOperatingSystem() decorator.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  tests/functional/qemu_test/__init__.py   |  2 +-
  tests/functional/qemu_test/decorators.py | 15 ++++++++++++++-
  2 files changed, 15 insertions(+), 2 deletions(-)


diff --git a/tests/functional/qemu_test/decorators.py b/tests/ functional/qemu_test/decorators.py
index 1651eb739a7..b6a1d41c55c 100644
--- a/tests/functional/qemu_test/decorators.py
+++ b/tests/functional/qemu_test/decorators.py
@@ -5,7 +5,7 @@
  import importlib
  import os
  import platform
-from unittest import skipUnless
+from unittest import skipIf, skipUnless
  from .cmd import which
@@ -26,6 +26,19 @@ def skipIfMissingCommands(*args):
      return skipUnless(has_cmds, 'required command(s) "%s" not installed' %
                                  ", ".join(args))
+'''
+Decorator to skip execution of a test if the current
+host operating system does not match one of the permitted
+ones.

"permitted ones" sounds like you'd need to specify the ones that are allowed to run the test, but it's rather the other way round, you have to specify the ones that are not able to run the test. I'd suggest to rewrite the comment accordingly.

+Example
+
+  @skipIfOperatingSystem("Linux", "Darwin")
+'''
+def skipIfOperatingSystem(*args):
+    return skipIf(platform.system() in args,
+                  'not running on one of the required OS(s) "%s"' %

Same here, maybe rather: "running on an OS (%s) that is not able to run this test" ?

Yes indeed, thanks!


Reply via email to