[diffoscope] [PATCH] fix old behaviour that all tools are required to execute test

anthraxx levente at leventepolyak.net
Sun Aug 21 01:42:15 CEST 2016


the conditions used to be that the tests were skipped if
any of the tools were not available. This means that all
of the passed tools need to be available by default to
preserve the old behaviour that was required f.e. in the pdf tests.

Additionally introduce a skip_unless_any_tool_exists method to
also provide a skip method that just requires to have one of the
passed tools available.
---
 tests/comparators/utils.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/comparators/utils.py b/tests/comparators/utils.py
index cfe89d0..965a486 100644
--- a/tests/comparators/utils.py
+++ b/tests/comparators/utils.py
@@ -36,12 +36,18 @@ from diffoscope.comparators.binary import FilesystemFile, NonExistingFile
 def set_locale():
     diffoscope.set_locale()
 
-def skip_unless_tool_exists(*alternatives):
+def skip_unless_any_tool_exists(*alternatives):
     return pytest.mark.skipif(
         not any(find_executable(x) for x in alternatives),
         reason="missing {}".format(" or ".join(alternatives)),
     )
 
+def skip_unless_tool_exists(*tools):
+    return pytest.mark.skipif(
+        not all(find_executable(x) for x in tools),
+        reason="missing {}".format(" or ".join(tools)),
+    )
+
 def load_fixture(filename):
     return pytest.fixture(
         lambda: specialize(FilesystemFile(filename))
-- 
2.9.2



More information about the diffoscope mailing list