Skip to content

Commit 81a41e4

Browse files
qwcodegvalkov
authored andcommitted
pep8 fixes
1 parent 9159a1d commit 81a41e4

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

tests/unit/test_req_file.py

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def test_split_req_with_option_equal(self):
4646
assert 'req', '--option=value' == partition_line('req --option=value')
4747

4848
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')
5051

5152

5253
class TestJoinLines(object):
@@ -77,27 +78,33 @@ class TestParseRequirementOptions(object):
7778

7879
def test_install_options_no_quotes(self):
7980
args = '--install-option --user'
80-
assert {'install_options': ['--user']} == parse_requirement_options(args)
81+
assert {'install_options': ['--user']} == \
82+
parse_requirement_options(args)
8183

8284
def test_install_options_quotes(self):
8385
args = "--install-option '--user'"
84-
assert {'install_options': ['--user']} == parse_requirement_options(args)
86+
assert {'install_options': ['--user']} == \
87+
parse_requirement_options(args)
8588

8689
def test_install_options_equals(self):
8790
args = "--install-option='--user'"
88-
assert {'install_options': ['--user']} == parse_requirement_options(args)
91+
assert {'install_options': ['--user']} == \
92+
parse_requirement_options(args)
8993

9094
def test_install_options_with_spaces(self):
9195
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)
9398

9499
def test_install_options_multiple(self):
95100
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)
97103

98104
def test_install_and_global_options(self):
99105
args = "--install-option='--user' --global-option='--author'"
100-
result = {'global_options': ['--author'], 'install_options': ['--user']}
106+
result = {'global_options': ['--author'],
107+
'install_options': ['--user']}
101108
assert result == parse_requirement_options(args)
102109

103110

@@ -170,9 +177,13 @@ def test_parse_content_requirements_file(self, monkeypatch):
170177
content = '-r another_file'
171178
req = InstallRequirement.from_line('SomeProject')
172179
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)
176187
assert list(parse_content('filename', content)) == [req]
177188

178189

@@ -196,10 +207,11 @@ def test_remote_reqs_parse(self):
196207
"""
197208
Test parsing a simple remote requirements file
198209
"""
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
201212
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/'
203215
'tests/req_just_comment.txt', session=PipSession()):
204216
pass
205217

@@ -287,7 +299,8 @@ def test_install_requirements_with_options(self, tmpdir, finder, session):
287299
with open(req_path, 'w') as fh:
288300
fh.write(content)
289301

290-
req = next(parse_requirements(req_path, finder=finder, session=session))
302+
req = next(parse_requirements(req_path, finder=finder,
303+
session=session))
291304

292305
req.source_dir = os.curdir
293306
with patch.object(subprocess, 'Popen') as popen:

0 commit comments

Comments
 (0)