diff --git a/.travis.yml b/.travis.yml index b725ae9..7c33f2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ python: - "3.4" - "3.5" before_install: - - pip install pytest pytest-cov + - pip install pytest pytest-cov pytest-catchlog install: "pip install -r requirements.txt" addons: apt: diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py index b2392fb..68d030a 100644 --- a/tests/test_bukuDb.py +++ b/tests/test_bukuDb.py @@ -234,14 +234,17 @@ class TestBukuDb(unittest.TestCase): # def test_import_bookmark(self): # self.fail() -def test_print_bookmark(capsys, setup): +def test_print_bookmark(capsys, caplog, setup): bdb = BukuDb() out, err = capsys.readouterr() # calling with nonexistent index bdb.print_bookmark(1) out, err = capsys.readouterr() - #assert out == "[ERROR] No matching index" - assert err == '' + + for record in caplog.records: + assert record.levelname == "ERROR" + assert record.getMessage() == "No matching index" + assert (out, err) == ('', '') # adding bookmarks bdb.add_bookmark("http://full-bookmark.com", "full", parse_tags(['full,bookmark']), "full bookmark")