Browse Source

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

main
John-Mark Gurney 4 years ago
parent
commit
b2ebb6c3d5
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      casimport/__init__.py

+ 9
- 1
casimport/__init__.py View File

@@ -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…
Cancel
Save