Skip to content

Commit

Permalink
Ignore requirement lines starting with dash (#315)
Browse files Browse the repository at this point in the history
* Add failing test

* Ignore requirement lines starting with `-`
  • Loading branch information
cjolowicz authored Mar 14, 2021
1 parent 89fefa6 commit 6876f06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nox_poetry/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def to_constraint(requirement_string: str, line: int) -> Optional[str]:
"""Convert requirement to constraint."""
if any(
requirement_string.startswith(prefix)
for prefix in ("-e ", "file://", "git+https://", "http://", "https://")
for prefix in ("-", "file://", "git+https://", "http://", "https://")
):
return None

Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ def test_session_build_package(proxy: nox_poetry.Session) -> None:
"regex==2020.10.28; python_version == '3.5'",
'regex==2020.10.28; python_version == "3.5"',
),
("-e ../lib/foo", ""),
(
"--extra-index-url https://example.com/pypi/simple",
"",
),
],
)
def test_to_constraints(requirements: str, expected: str) -> None:
Expand Down

0 comments on commit 6876f06

Please sign in to comment.