1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Add an --install|global-option functional test

This commit is contained in:
Georgi Valkov 2015-03-21 18:32:44 +01:00
parent 832c050ca4
commit 1c0021b268
3 changed files with 37 additions and 0 deletions

View file

@ -104,4 +104,9 @@ requires_simple_extra-0.1-py2.py3-none-any.whl
----------------------------------------------
requires_simple_extra[extra] requires simple==1.0
setuppyargs-0.1.tar.gz
----------------------
An empty package that will output the arguments with which its 'setup.py' was
called when installed. If the PIPTEST_SETUPPYARGS_FILE environment variable is
set, the argument list will be written to that file in json format.

Binary file not shown.

View file

@ -1,3 +1,4 @@
import json
import os.path
import textwrap
@ -106,6 +107,37 @@ def test_multiple_requirements_files(script, tmpdir):
assert script.venv / 'src' / 'initools' in result.files_created
def test_requirement_file_options(script, data, tmpdir):
"""
Test setting --install-option and --global-option in requirements files.
"""
# When the setuppyargs package is installed, it will write the
# arguments with which its setup.py file was called in
# PIPTEST_SETUPPYARGS_FILE.
setuppyargs_file = tmpdir / 'setup-py-args'
script.environ['PIPTEST_SETUPPYARGS_FILE'] = str(setuppyargs_file)
def getsetuppyargs(contents):
contents = textwrap.dedent(contents)
script.scratch_path.join('reqfileopts.txt').write(contents)
script.pip('install', '--no-index', '-f', data.find_links,
'-r', script.scratch_path / 'reqfileopts.txt',
expect_error=True)
return json.load(open(setuppyargs_file))
reqfile = '''
setuppyargs==1.0 --global-option="--one --two" \\
--global-option="--three" \\
--install-option "--four -5" \\
--install-option="-6"
'''
args = getsetuppyargs(reqfile)
expected = set(['--one', '--two', '--three', '--four', '-5', '-6'])
assert expected.issubset(set(args))
def test_respect_order_in_requirements_file(script, data):
script.scratch_path.join("frameworks-req.txt").write(textwrap.dedent("""\
parent