Handle requirements.txt with `--pre` lines

This is a global flag which our inspection of requirements.txt files
should ignore as it doesn't imply a local reference.
pull/943/head
Tim Head 2020-08-13 14:00:16 +02:00
rodzic cb3da62645
commit 6d2b129ed8
2 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -469,6 +469,10 @@ def is_local_pip_requirement(line):
if line.startswith(("--requirement", "--constraint")):
# as above but flags are spelt out
return True
# the `--pre` flag is a global flag and should appear on a line by itself
# we just care that this isn't a "local pip requirement"
if line.startswith("--pre"):
return False
# strip off things like `--editable=`. Long form arguments require a =
if line.startswith("--"):
line = line.split("=", 1)[1]

Wyświetl plik

@ -146,6 +146,8 @@ def test_open_guess_encoding():
("git+https://github.com/jupyterhub/repo2docker", False),
("numpy", False),
("# -e .", False),
("--pre", False),
("--pre pandas", False),
],
)
def test_local_pip_requirement(req, is_local):