[Git][reproducible-builds/diffoscope][master] 2 commits: Add some explicit return values to appease pylint, etc.
Chris Lamb
gitlab at salsa.debian.org
Fri Jul 12 16:04:11 UTC 2019
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
6a9faf80 by Chris Lamb at 2019-07-12T15:53:54Z
Add some explicit return values to appease pylint, etc.
- - - - -
d5b9daf0 by Chris Lamb at 2019-07-12T15:56:02Z
Merge two overlapping environment variables into DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS.
- - - - -
2 changed files:
- debian/tests/pytest
- tests/utils/tools.py
Changes:
=====================================
debian/tests/pytest
=====================================
@@ -9,8 +9,7 @@ fi
export LIBGUESTFS_MEMSIZE=128
if [ "$(basename "$0")" = "pytest-with-recommends" ]; then
- export DIFFOSCOPE_TESTS_FAIL_ON_MISSING_TOOLS=1
- export DIFFOSCOPE_TESTS_MISSING_TOOLS="apktool zipinfo pedump oggDump ppudump cbfstool otool lipo wasm2wat"
+ export DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS="apktool zipinfo pedump oggDump ppudump cbfstool otool lipo wasm2wat"
fi
cp -r tests "$ADTTMP"
=====================================
tests/utils/tools.py
=====================================
@@ -45,28 +45,28 @@ def skipif(*args, **kwargs):
"""
Call `pytest.mark.skipif` with the specified arguments.
- As a special-case, if the DIFFOSCOPE_TESTS_FAIL_ON_MISSING_TOOLS
- environment variable is exported, this alters the behaviour such that a
- missing tool is treated as a failed test. For more information on the
- rationale here, please see issue #35.
+ If the DIFFOSCOPE_TESTS_FAIL_ON_MISSING_TOOLS environment variable is
+ exported this alters the behaviour such that a tool listed within this
+ variable is treated as a failed test instead of being skipped.
+
+ For more information on the rationale here, see issue #35.
"""
- if os.environ.get('DIFFOSCOPE_TESTS_FAIL_ON_MISSING_TOOLS', None) != '1':
+ key = 'DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS'
+ val = os.environ.get(key)
+
+ if val is None:
return pytest.mark.skipif(*args, **kwargs)
- missing_tools = os.environ.get(
- 'DIFFOSCOPE_TESTS_MISSING_TOOLS', ''
- ).split()
- missing_tools.append('/missing') # special value used in tests
tools_required = kwargs.get('tools', ())
+ missing_tools = val.split() + ['/missing'] # special value used in tests
+
if not tools_required or any(
x for x in tools_required if x in missing_tools
):
return pytest.mark.skipif(*args, **kwargs)
- msg = "{} (DIFFOSCOPE_TESTS_FAIL_ON_MISSING_TOOLS=1)".format(
- kwargs['reason']
- )
+ msg = "{} ({}={})".format(kwargs['reason'], key, val)
# We cannot simply call pytest.fail here as that would result in a failure
# during the test collection phase instead when the test is actually
@@ -75,6 +75,7 @@ def skipif(*args, **kwargs):
def inner(*args2, **kwargs2):
if args[0]: # i.e. the condition of the skipif() is True
return pytest.fail(msg)
+ return None
return inner
@@ -182,6 +183,8 @@ def module_is_not_importable(x):
# import ``debian`` so we must handle that failing.
return True
+ return False
+
def skip_unless_module_exists(name):
return skipif(
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/b99b03d581deb97d95a250ae5432758acf89f6f6...d5b9daf05dfd3b3e4cc8dd6f7f8c2fbbfcd62cc0
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/b99b03d581deb97d95a250ae5432758acf89f6f6...d5b9daf05dfd3b3e4cc8dd6f7f8c2fbbfcd62cc0
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190712/35db5a6d/attachment.html>
More information about the rb-commits
mailing list