瀏覽代碼

mark a test function as no cover, and add a test to cover an error case

main
John-Mark Gurney 4 年之前
父節點
當前提交
b2ebb6c3d5
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. +9
    -1
      casimport/__init__.py

+ 9
- 1
casimport/__init__.py 查看文件

@@ -38,7 +38,7 @@ import urllib.request
from importlib.abc import MetaPathFinder, Loader
from importlib.machinery import ModuleSpec

def _printanyexc(f):
def _printanyexc(f): # pragma: no cover
'''Prints any exception that gets raised by the wrapped function.'''

@functools.wraps(f)
@@ -582,8 +582,16 @@ class Test(unittest.TestCase):
self.assertEqual(data, ipfsdata)

with self.assertRaises(ValueError):
# that a hash url fails
ipfs.fetch_data(urllib.parse.urlparse('hash://sha256/asldfkj'))

# that when the request fails
uomock.return_value.__enter__.return_value.status = 400

# it raises a RuntimeError
with self.assertRaises(RuntimeError):
ipfs.fetch_data(hashurl)

def test_overlappingaliases(self):
# make sure that an aliases file is consistent and does not
# override other urls. That is that any hashes are


Loading…
取消
儲存