Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Feb 17, 2019
1 parent fc0d144 commit 59e16e4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/test_add_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def test_disabled_logger_in_sink(sink_with_logger):

def test_invalid_function_kwargs():
def function(message, a="Y"):
pass
raise NotImplementedError

logger.add(function, b="X", catch=False)
with pytest.raises(TypeError):
Expand All @@ -384,7 +384,7 @@ def __init__(self):
self.out = ""

def write(self, m):
pass
raise NotImplementedError

writer = Writer()
logger.add(writer, format="{message}", kw1="1", kw2="2", catch=False)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,6 @@ def test_enqueue_exception(writer):
def test_enqueue_with_other_handlers(writer):
def check_tb_sink(message):
exception = message.record["exception"]
if exception is None:
return
assert exception.traceback is not None

logger.add(check_tb_sink, enqueue=False, catch=False)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ def __init__(self, sleep_time):
self.stopped = False

def write(self, message):
if self.stopped:
raise RuntimeError("Can't write on stopped sink")
assert not self.stopped

length = len(message)
self.written += message[:length]
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ source = .

[coverage:report]
include = loguru/*, tests/*

exclude_lines =
\#\s*pragma: no cover
^\s*raise NotImplementedError\b

0 comments on commit 59e16e4

Please sign in to comment.