def test_value_to_envval(): assert value_to_envval(True) == "true" assert value_to_envval(False) == "false" assert value_to_envval(12345) == "12345" assert value_to_envval("foobar") == "foobar" with pytest.raises(TypeError): value_to_envval(str) with pytest.raises(TypeError): value_to_envval([])
def call(*args, **kwargs): pip_exec = kwargs.pop("pip_exec", _PIP_EXECUTABLE) params = sequencify(pip_exec) + sequencify(args) for flag, value in iteritems(kwargs): if value != False: flag = "--%s" % kebab_case(flag, delimiter = "_") params.append(flag) if not isinstance(value, bool): value = value_to_envval(value) params.append(value) return popen(*params, output = True)
def call(*args, **kwargs): pip_exec = kwargs.pop("pip_exec", None) or _PIP_EXECUTABLE quiet = kwargs.pop("quiet", None) or False output = kwargs.pop("output", None) or False raise_err = kwargs.pop("raise_err", None) or True params = sequencify(pip_exec) + sequencify(args) for flag, value in iteritems(kwargs): if value != False: flag = "--%s" % kebab_case(flag, delimiter="_") params.append(flag) if not isinstance(value, bool): value = value_to_envval(value) params.append(value) output = output or quiet output = popen(*params, output=output, raise_err=raise_err) return output