@@ -46,7 +46,8 @@ def test_split_req_with_option_equal(self):
46
46
assert 'req' , '--option=value' == partition_line ('req --option=value' )
47
47
48
48
def test_split_req_with_option_and_flag (self ):
49
- assert 'req' , '--option=value --flag' == partition_line ('req --option=value --flag' )
49
+ assert 'req' , '--option=value --flag' == \
50
+ partition_line ('req --option=value --flag' )
50
51
51
52
52
53
class TestJoinLines (object ):
@@ -77,27 +78,33 @@ class TestParseRequirementOptions(object):
77
78
78
79
def test_install_options_no_quotes (self ):
79
80
args = '--install-option --user'
80
- assert {'install_options' : ['--user' ]} == parse_requirement_options (args )
81
+ assert {'install_options' : ['--user' ]} == \
82
+ parse_requirement_options (args )
81
83
82
84
def test_install_options_quotes (self ):
83
85
args = "--install-option '--user'"
84
- assert {'install_options' : ['--user' ]} == parse_requirement_options (args )
86
+ assert {'install_options' : ['--user' ]} == \
87
+ parse_requirement_options (args )
85
88
86
89
def test_install_options_equals (self ):
87
90
args = "--install-option='--user'"
88
- assert {'install_options' : ['--user' ]} == parse_requirement_options (args )
91
+ assert {'install_options' : ['--user' ]} == \
92
+ parse_requirement_options (args )
89
93
90
94
def test_install_options_with_spaces (self ):
91
95
args = "--install-option='--arg=value1 value2 value3'"
92
- assert {'install_options' : ['--arg=value1 value2 value3' ]} == parse_requirement_options (args )
96
+ assert {'install_options' : ['--arg=value1 value2 value3' ]} == \
97
+ parse_requirement_options (args )
93
98
94
99
def test_install_options_multiple (self ):
95
100
args = "--install-option='--user' --install-option='--root'"
96
- assert {'install_options' : ['--user' , '--root' ]} == parse_requirement_options (args )
101
+ assert {'install_options' : ['--user' , '--root' ]} == \
102
+ parse_requirement_options (args )
97
103
98
104
def test_install_and_global_options (self ):
99
105
args = "--install-option='--user' --global-option='--author'"
100
- result = {'global_options' : ['--author' ], 'install_options' : ['--user' ]}
106
+ result = {'global_options' : ['--author' ],
107
+ 'install_options' : ['--user' ]}
101
108
assert result == parse_requirement_options (args )
102
109
103
110
@@ -170,9 +177,13 @@ def test_parse_content_requirements_file(self, monkeypatch):
170
177
content = '-r another_file'
171
178
req = InstallRequirement .from_line ('SomeProject' )
172
179
import pip .req .req_file
173
- call = lambda req_url , finder , comes_from , options , session : [req ]
174
- parse_requirements_stub = stub (call = call )
175
- monkeypatch .setattr (pip .req .req_file , 'parse_requirements' , parse_requirements_stub .call )
180
+
181
+ def stub_parse_requirements (req_url , finder , comes_from , options ,
182
+ session ):
183
+ return [req ]
184
+ parse_requirements_stub = stub (call = stub_parse_requirements )
185
+ monkeypatch .setattr (pip .req .req_file , 'parse_requirements' ,
186
+ parse_requirements_stub .call )
176
187
assert list (parse_content ('filename' , content )) == [req ]
177
188
178
189
@@ -196,10 +207,11 @@ def test_remote_reqs_parse(self):
196
207
"""
197
208
Test parsing a simple remote requirements file
198
209
"""
199
- # this requirements file just contains a comment
200
- # previously this has failed in py3: https://github.com/pypa/pip/issues/760
210
+ # this requirements file just contains a comment previously this has
211
+ # failed in py3: https://github.com/pypa/pip/issues/760
201
212
for req in parse_requirements (
202
- 'https://raw.githubusercontent.com/pypa/pip-test-package/master/'
213
+ 'https://raw.githubusercontent.com/pypa/'
214
+ 'pip-test-package/master/'
203
215
'tests/req_just_comment.txt' , session = PipSession ()):
204
216
pass
205
217
@@ -287,7 +299,8 @@ def test_install_requirements_with_options(self, tmpdir, finder, session):
287
299
with open (req_path , 'w' ) as fh :
288
300
fh .write (content )
289
301
290
- req = next (parse_requirements (req_path , finder = finder , session = session ))
302
+ req = next (parse_requirements (req_path , finder = finder ,
303
+ session = session ))
291
304
292
305
req .source_dir = os .curdir
293
306
with patch .object (subprocess , 'Popen' ) as popen :
0 commit comments