[Git][reproducible-builds/diffoscope][master] 2 commits: Use repr(..)-style output when printing DIFFOSCOPE_TESTS_FAIL_ON_MISSING_TOOLS...
Chris Lamb
gitlab at salsa.debian.org
Fri Jul 12 19:25:44 UTC 2019
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
f903ae2d by Chris Lamb at 2019-07-12T19:24:06Z
Use repr(..)-style output when printing DIFFOSCOPE_TESTS_FAIL_ON_MISSING_TOOLS in skipped test rationale text.
- - - - -
372346e4 by Chris Lamb at 2019-07-12T19:25:32Z
Don't fail in autopkgtests when, for example, we do not have sufficiently newer or older version of file. (Closes: #931881)
- - - - -
1 changed file:
- tests/utils/tools.py
Changes:
=====================================
tests/utils/tools.py
=====================================
@@ -45,13 +45,17 @@ def skipif(*args, **kwargs):
"""
Call `pytest.mark.skipif` with the specified arguments.
- 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.
+ If `check_env_for_missing_tools=True` is passed and 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 not kwargs.get('check_env_for_missing_tools', False):
+ return pytest.mark.skipif(*args, **kwargs)
+
key = 'DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS'
val = os.environ.get(key)
@@ -66,7 +70,7 @@ def skipif(*args, **kwargs):
):
return pytest.mark.skipif(*args, **kwargs)
- msg = "{} ({}={})".format(kwargs['reason'], key, val)
+ msg = "{} ({}={!r})".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
@@ -87,6 +91,7 @@ def skip_unless_tools_exist(*required):
tools_missing(*required),
reason="requires {}".format(" and ".join(required)),
tools=required,
+ check_env_for_missing_tools=True,
)
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/d5b9daf05dfd3b3e4cc8dd6f7f8c2fbbfcd62cc0...372346e4990114f6305e66a6a13b0f267b83f9d7
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/d5b9daf05dfd3b3e4cc8dd6f7f8c2fbbfcd62cc0...372346e4990114f6305e66a6a13b0f267b83f9d7
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/2905a38a/attachment.html>
More information about the rb-commits
mailing list