Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_disallowed_args(self, runner, arg):
"""This method tests that all the potential disallowed arguments match their error messages."""
# run shiv with a disallowed argument
result = runner(["-o", "tmp", arg])
# get the 'reason' message:
for disallowed in DISALLOWED_ARGS:
if arg in disallowed:
reason = DISALLOWED_ARGS[disallowed]
assert result.exit_code == 1
# assert we got the correct reason
assert DISALLOWED_PIP_ARGS.format(arg=arg, reason=reason) in result.output