From 687971a3abcf6e70f1a54f9eab97b938062cf47e Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Wed, 26 Oct 2016 01:27:54 +0200 Subject: [PATCH] Add a makefile coverage target And expand a tiny bit the test suite to exercise one more error path. Current coverage is not bad, ~87% lines coverage. For some reason, no branch coverage is available :/ --- Makefile | 8 +++++++- test/test_xattr.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a41a077..9d42db0 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,16 @@ test: pypy ./setup.py test -q; \ fi +coverage: + $(MAKE) clean + $(MAKE) test CFLAGS="-coverage" + lcov --capture --directory . --output-file coverage.info + genhtml coverage.info --output-directory out + clean: rm -rf $(DOCHTML) $(DOCTREES) rm -f $(MODNAME) rm -f *.so rm -rf build -.PHONY: doc test clean dist +.PHONY: doc test clean dist coverage diff --git a/test/test_xattr.py b/test/test_xattr.py index b411414..4dce945 100644 --- a/test/test_xattr.py +++ b/test/test_xattr.py @@ -421,6 +421,9 @@ class xattrTest(unittest.TestCase): xattr.set(fh, self.USER_ATTR, self.EMPTY_VAL) self.assertEqual(xattr.get(fh, self.USER_ATTR), self.EMPTY_VAL) + def testWrongType(self): + self.assertRaises(TypeError, xattr.get, object(), self.USER_ATTR) + if __name__ == "__main__": unittest.main() -- 2.39.2