From c1f69d9b350395885f719421f72c5a7963228e2b Mon Sep 17 00:00:00 2001 From: poikjhn Date: Sun, 12 Jun 2016 22:04:57 +0200 Subject: [PATCH] adding test_close_quit and coverage reporting --- .gitignore | 1 + .travis.yml | 2 ++ tests/ci-test-wrapper | 2 +- tests/test_bukuDb.py | 15 +++++++++++++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 614d328..40ec187 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.py[co] *.sw[po] .cache/ +.coverage diff --git a/.travis.yml b/.travis.yml index b280081..b725ae9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ python: - "3.3" - "3.4" - "3.5" +before_install: + - pip install pytest pytest-cov install: "pip install -r requirements.txt" addons: apt: diff --git a/tests/ci-test-wrapper b/tests/ci-test-wrapper index 17fb500..e466bf7 100755 --- a/tests/ci-test-wrapper +++ b/tests/ci-test-wrapper @@ -90,4 +90,4 @@ fi # Test buku(1) with $repo_root at the beginning of $PATH (so that buku # from this repo is picked up). cd $here -PATH="$repo_root:$PATH" python -m pytest test_*.py +PATH="$repo_root:$PATH" python -m pytest test_*.py --cov buku diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py index 927105c..c654620 100644 --- a/tests/test_bukuDb.py +++ b/tests/test_bukuDb.py @@ -205,8 +205,19 @@ class TestBukuDb(unittest.TestCase): # def test_browse_by_index(self): # self.fail() - # def test_close_quit(self): - # self.fail() + # @unittest.skip('skipping') + def test_close_quit(self): + bdb=BukuDb() + # quitting with no args + try: + bdb.close_quit() + except SystemExit as err: + self.assertEqual(err.args[0], 0) + # quitting with custom arg + try: + bdb.close_quit(1) + except SystemExit as err: + self.assertEqual(err.args[0], 1) # def test_import_bookmark(self): # self.fail()