mirror of https://github.com/pypa/pip
Remove misleading test cases and improve docs
This commit is contained in:
parent
29f0c75c63
commit
0da51b14d7
|
@ -165,9 +165,17 @@ script as:
|
|||
|
||||
python setup.py --no-user-cfg install --prefix='/usr/local' --no-compile
|
||||
|
||||
Note that the correct way of giving more than one option to
|
||||
``setup.py`` is through multiple ``--global-option`` and
|
||||
``--install-option`` options, as shown in the example above.
|
||||
Note that the only way of giving more than one option to ``setup.py``
|
||||
is through multiple ``--global-option`` and ``--install-option``
|
||||
options, as shown in the example above. The value of each option is
|
||||
passed as a single argument to the ``setup.py`` script. Therefore, a
|
||||
line such as the following is invalid and would result in an
|
||||
installation error.
|
||||
|
||||
::
|
||||
|
||||
# Invalid. Please use '--install-option' twice as shown above.
|
||||
FooProject >= 1.2 --install-option="--prefix=/usr/local --no-compile"
|
||||
|
||||
|
||||
.. _`Pre Release Versions`:
|
||||
|
|
|
@ -127,14 +127,18 @@ def test_requirement_file_options(script, data, tmpdir):
|
|||
return json.load(open(setuppyargs_file))
|
||||
|
||||
reqfile = '''
|
||||
setuppyargs==1.0 --global-option="--one --two" \\
|
||||
--global-option="--three" \\
|
||||
--install-option "--four -5" \\
|
||||
--install-option="-6"
|
||||
setuppyargs==1.0 --global-option="--onetwo" \\
|
||||
--global-option="--three" \\
|
||||
--install-option "--four-5" \\
|
||||
--install-option="-6" \\
|
||||
--install-option="--opt-with-ws=a b c"
|
||||
'''
|
||||
|
||||
args = getsetuppyargs(reqfile)
|
||||
expected = set(['--one --two', '--three', '--four -5', '-6'])
|
||||
expected = set([
|
||||
'--onetwo', '--three',
|
||||
'--four-5', '-6', '--opt-with-ws=a b c'
|
||||
])
|
||||
assert expected.issubset(set(args))
|
||||
|
||||
|
||||
|
|
|
@ -511,29 +511,31 @@ def test_parse_flags_from_requirements(finder):
|
|||
|
||||
|
||||
def test_get_requirement_options():
|
||||
res = parse_requirement_options('--install-option="--abc --zxc"')
|
||||
assert res == {'install_options': ['--abc --zxc']}
|
||||
|
||||
res = parse_requirement_options('--global-option "--abc"')
|
||||
assert res == {'global_options': ['--abc']}
|
||||
|
||||
# Note the '--arg-with-spaces=a b c' is passed as a single
|
||||
# argument to setup.py.
|
||||
res = parse_requirement_options('--install-option="--opt-spaces=a b c"')
|
||||
assert res == {'install_options': ['--opt-spaces=a b c']}
|
||||
|
||||
line = (
|
||||
'INITools==2.0 '
|
||||
'--global-option="--one --two -3" '
|
||||
'--global-option="--one --two=3 3.5" '
|
||||
'--global-option="--four" '
|
||||
'--install-option="--prefix=/opt" '
|
||||
'--install-option="--help" '
|
||||
)
|
||||
assert parse_line(line) == (REQUIREMENT, (
|
||||
'INITools==2.0', {
|
||||
'global_options': ['--one --two -3', '--four'],
|
||||
'global_options': ['--one --two=3 3.5', '--four'],
|
||||
'install_options': ['--prefix=/opt', '--help'],
|
||||
}))
|
||||
|
||||
|
||||
def test_install_requirements_with_options(tmpdir, finder, session):
|
||||
content = '''
|
||||
INITools == 2.0 --global-option="--one --two -3" \
|
||||
INITools == 2.0 --global-option="--one-two-3" \
|
||||
--install-option "--prefix=/opt"
|
||||
'''
|
||||
|
||||
|
@ -551,7 +553,7 @@ def test_install_requirements_with_options(tmpdir, finder, session):
|
|||
pass
|
||||
|
||||
call = popen.call_args_list[0][0][0]
|
||||
for i in '--one --two -3', '--prefix=/opt':
|
||||
for i in '--one-two-3', '--prefix=/opt':
|
||||
assert i in call
|
||||
|
||||
# TODO: assert that --global-option come before --install-option.
|
||||
|
|
Loading…
Reference in New Issue