Skip to content

Commit 480a6f4

Browse files
qwcodegvalkov
authored andcommitted
add tests for raising RequirementsFileParseError
1 parent 81a41e4 commit 480a6f4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/unit/test_req_file.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77
from pretend import stub
88

9+
from pip.exceptions import RequirementsFileParseError
910
from pip.download import PipSession
1011
from pip.index import PackageFinder
1112
from pip.req.req_install import InstallRequirement
@@ -111,9 +112,6 @@ def test_install_and_global_options(self):
111112
class TestParseLine(object):
112113
"""tests for `parse_line`"""
113114

114-
# TODO
115-
# parser error tests
116-
117115
def test_parse_line_editable(self):
118116
assert parse_line('-e url') == (REQUIREMENT_EDITABLE, 'url')
119117
assert parse_line('--editable url') == (REQUIREMENT_EDITABLE, 'url')
@@ -147,6 +145,15 @@ def test_parse_line_requirement_with_options(self):
147145
('SomeProject', {'install_options': ['--user']})
148146
)
149147

148+
def test_flag_with_value_raises(self):
149+
with pytest.raises(RequirementsFileParseError):
150+
parse_line('--no-index url')
151+
152+
def test_option_with_no_value_raises(self):
153+
with pytest.raises(RequirementsFileParseError):
154+
parse_line('--index-url')
155+
156+
150157

151158
class TestParseContent(object):
152159
"""tests for `parse_content`"""

0 commit comments

Comments
 (0)