[diffoscope] 02/02: tests: utils: tools: adds support for modules on skip_unless* annotations

Juliana Oliveira jwnx-guest at moszumanska.debian.org
Fri Jan 5 05:09:19 CET 2018


This is an automated email from the git hooks/post-receive script.

jwnx-guest pushed a commit to branch jwnx_fix_progressbar
in repository diffoscope.

commit dd739d5a7a0dff10df7bc7bb0fd3f4b9d8a069e0
Author: Juliana Oliveira <juliana.orod at gmail.com>
Date:   Fri Jan 5 01:54:46 2018 -0200

    tests: utils: tools: adds support for modules on skip_unless* annotations
    
    skip_unless* annotations now also check for /modules/ existence, just like a
    regular tool.
    
    Signed-off-by: Juliana Oliveira <juliana.orod at gmail.com>
---
 tests/utils/tools.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/utils/tools.py b/tests/utils/tools.py
index 9518306..0db1a09 100644
--- a/tests/utils/tools.py
+++ b/tests/utils/tools.py
@@ -48,7 +48,7 @@ def skip_if_tool_version_is(tool, actual_ver, target_ver, vcls=LooseVersion):
     )
 
 def skip_unless_tool_is_at_least(tool, actual_ver, min_ver, vcls=LooseVersion):
-    if tools_missing(tool):
+    if tools_missing(tool) and module_is_not_importable(tool):
         return pytest.mark.skipif(True, reason="requires {}".format(tool))
     if callable(actual_ver):
         actual_ver = actual_ver()
@@ -59,7 +59,7 @@ def skip_unless_tool_is_at_least(tool, actual_ver, min_ver, vcls=LooseVersion):
 
 
 def skip_unless_tool_is_at_most(tool, actual_ver, max_ver, vcls=LooseVersion):
-    if tools_missing(tool):
+    if tools_missing(tool) and module_is_not_importable(tool):
         return pytest.mark.skipif(True, reason="requires {}".format(tool))
     if callable(actual_ver):
         actual_ver = actual_ver()
@@ -119,3 +119,5 @@ def skip_unless_module_exists(name):
         module_is_not_importable(name),
         reason="requires {} module".format(name),
     )
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list