未验证 提交 8a36145f 编辑于 作者: Anthony Sottile's avatar Anthony Sottile 提交者: GitHub
浏览文件

Merge pull request #425 from vinayinvicible/url-req

Fixed sorting for non editable requirement urls
显示 8 个添加2 个删除
+8 -2
......@@ -21,8 +21,9 @@ class Requirement(object):
@property
def name(self): # type: () -> bytes
assert self.value is not None, self.value
if self.value.startswith(b'-e '):
return self.value.lower().partition(b'=')[-1]
for egg in (b'#egg=', b'&egg='):
if egg in self.value:
return self.value.lower().partition(egg)[-1]
return self.value.lower().partition(b'==')[0]
......
......@@ -45,6 +45,11 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
),
(b'bar\npkg-resources==0.0.0\nfoo\n', FAIL, b'bar\nfoo\n'),
(b'foo\npkg-resources==0.0.0\nbar\n', FAIL, b'bar\nfoo\n'),
(
b'git+ssh://git_url@tag#egg=ocflib\nDjango\nijk\n',
FAIL,
b'Django\nijk\ngit+ssh://git_url@tag#egg=ocflib\n',
),
),
)
def test_integration(input_s, expected_retval, output, tmpdir):
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册