mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Return a default value from get_revision() if URL unrecognized.
This commit is contained in:
parent
a93d0ed25c
commit
7981cc1f9e
2 changed files with 7 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ def get_revision(url, *, _open_url=open_url):
|
|||
if url.startswith('https://github.com/'):
|
||||
return github_get_revision(url, _open_url=_open_url)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
return '<unknown>'
|
||||
|
||||
|
||||
def get_checksum(data):
|
||||
|
|
|
|||
|
|
@ -14,6 +14,12 @@ class GetRevisionTests(unittest.TestCase):
|
|||
|
||||
self.assertEqual(revision, 'fc2395ca3564fb2afded8d90ddbe38dad1bf86f1')
|
||||
|
||||
def test_unrecognized_url(self):
|
||||
revision = get_revision('https://localhost/schema.json',
|
||||
_open_url=lambda _: io.BytesIO())
|
||||
|
||||
self.assertEqual(revision, '<unknown>')
|
||||
|
||||
|
||||
class GetChecksumTests(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue