From 6876f06155a03de3817d5232dda5099d7004eaef Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Sun, 14 Mar 2021 21:47:36 +0100 Subject: [PATCH] Ignore requirement lines starting with dash (#315) * Add failing test * Ignore requirement lines starting with `-` --- src/nox_poetry/sessions.py | 2 +- tests/unit/test_sessions.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nox_poetry/sessions.py b/src/nox_poetry/sessions.py index 538125fa..1c73174b 100644 --- a/src/nox_poetry/sessions.py +++ b/src/nox_poetry/sessions.py @@ -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 diff --git a/tests/unit/test_sessions.py b/tests/unit/test_sessions.py index 1f3ecf22..a1994585 100644 --- a/tests/unit/test_sessions.py +++ b/tests/unit/test_sessions.py @@ -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: