mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-10 05:14:18 +00:00
Fixed sorting for non editable requirement urls
This commit is contained in:
parent
00e8510d9c
commit
189e33e48c
2 changed files with 8 additions and 2 deletions
|
|
@ -21,8 +21,9 @@ class Requirement(object):
|
||||||
@property
|
@property
|
||||||
def name(self): # type: () -> bytes
|
def name(self): # type: () -> bytes
|
||||||
assert self.value is not None, self.value
|
assert self.value is not None, self.value
|
||||||
if self.value.startswith(b'-e '):
|
for egg in (b'#egg=', b'&egg='):
|
||||||
return self.value.lower().partition(b'=')[-1]
|
if egg in self.value:
|
||||||
|
return self.value.lower().partition(egg)[-1]
|
||||||
|
|
||||||
return self.value.lower().partition(b'==')[0]
|
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'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'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):
|
def test_integration(input_s, expected_retval, output, tmpdir):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue