Browse Source

add coverage support, and cover a line, and mark a couple lines no cover

main
John-Mark Gurney 5 years ago
parent
commit
835e4f1815
3 changed files with 4 additions and 2 deletions
  1. +1
    -1
      ui/Makefile
  2. +2
    -1
      ui/cli.py
  3. +1
    -0
      ui/requirements.txt

+ 1
- 1
ui/Makefile View File

@@ -1,6 +1,6 @@
test: fixtures/sample.data.pasn1
(. ./p/bin/activate && \
(echo cli.py | entr python -m unittest cli))
(echo cli.py | entr sh -c 'python -m coverage run -m unittest cli && coverage report -m --omit=p/\*'))

env:
virtualenv p


+ 2
- 1
ui/cli.py View File

@@ -77,7 +77,7 @@ class MetaData(MDBase):
def _trytodict(o):
try:
return 'dict', o.__to_dict__()
except Exception:
except Exception: # pragma: no cover
raise TypeError('unable to find __to_dict__ on %s' % type(o))

_asn1coder = pasn1.ASN1DictCoder(coerce=_trytodict)
@@ -228,6 +228,7 @@ class _TestCases(unittest.TestCase):
def test_makehash(self):
self.assertRaises(ValueError, ObjectStore.makehash, 'slkj')
self.assertRaises(ValueError, ObjectStore.makehash, 'sha256:91751cee0a1ab8414400238a761411daa29643ab4b8243e9a91649e25be53ADA')
self.assertRaises(ValueError, ObjectStore.makehash, 'bogushash:9e0a1ab8414400238a761411daa29643ab4b8243e9a91649e25be53ADA', strict=False)

self.assertEqual(ObjectStore.makehash('cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e', strict=False), 'sha512:cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e')
self.assertEqual(ObjectStore.makehash('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', strict=False), 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')


+ 1
- 0
ui/requirements.txt View File

@@ -1,2 +1,3 @@
urwid
-e git://github.com/jmgurney/pasn1@27ff594a2609c07205753ce24f74d8f45a7ea418#egg=pasn1
coverage

Loading…
Cancel
Save