1
+ from optparse import Values
1
2
import os
2
3
import subprocess
3
4
from textwrap import dedent
11
12
ReqFileOnleOneOptionPerLineError ,
12
13
ReqFileOptionNotAllowedWithReqError )
13
14
from pip .download import PipSession
14
- from pip .index import PackageFinder
15
+ from pip .index import FormatControl , PackageFinder
15
16
from pip .req .req_install import InstallRequirement
16
17
from pip .req .req_file import (parse_requirements , process_line , join_lines ,
17
18
ignore_comments )
@@ -68,8 +69,10 @@ class TestProcessLine(object):
68
69
"""tests for `process_line`"""
69
70
70
71
def setup (self ):
71
- self .options = stub (isolated_mode = False , default_vcs = None ,
72
- skip_requirements_regex = False )
72
+ self .options = stub (
73
+ isolated_mode = False , default_vcs = None ,
74
+ skip_requirements_regex = False ,
75
+ format_control = pip .index .FormatControl (set (), set ()))
73
76
74
77
def test_parser_error (self ):
75
78
with pytest .raises (RequirementsFileParseError ):
@@ -335,6 +338,7 @@ def test_install_requirements_with_options(self, tmpdir, finder, session):
335
338
install_option = '--prefix=/opt'
336
339
337
340
content = '''
341
+ --only-binary :all:
338
342
INITools==2.0 --global-option="{global_option}" \
339
343
--install-option "{install_option}"
340
344
''' .format (global_option = global_option , install_option = install_option )
@@ -343,8 +347,12 @@ def test_install_requirements_with_options(self, tmpdir, finder, session):
343
347
with open (req_path , 'w' ) as fh :
344
348
fh .write (content )
345
349
346
- req = next (parse_requirements (req_path , finder = finder ,
347
- session = session ))
350
+ options = Values ()
351
+ options .format_control = FormatControl (set (), set ())
352
+ options .skip_requirements_regex = None
353
+ options .isolated_mode = False
354
+ req = next (parse_requirements (
355
+ req_path , finder = finder , options = options , session = session ))
348
356
349
357
req .source_dir = os .curdir
350
358
with patch .object (subprocess , 'Popen' ) as popen :
@@ -357,3 +365,5 @@ def test_install_requirements_with_options(self, tmpdir, finder, session):
357
365
assert call .index (install_option ) > \
358
366
call .index ('install' ) > \
359
367
call .index (global_option ) > 0
368
+ assert options .format_control .no_binary == set ([':all:' ])
369
+ assert options .format_control .only_binary == set ([])
0 commit comments