forked from thombashi/pytablewriter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_logger.py
46 lines (35 loc) · 1.08 KB
/
test_logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function, unicode_literals
import pytest
from pytablewriter import set_log_level, set_logger
logbook = pytest.importorskip("logbook", minversion="0.12.3")
import logbook # isort:skip
class Test_set_logger(object):
@pytest.mark.parametrize(["value"], [[True], [False]])
def test_smoke(self, value):
set_logger(value)
class Test_set_log_level(object):
@pytest.mark.parametrize(
["value"],
[
[logbook.CRITICAL],
[logbook.ERROR],
[logbook.WARNING],
[logbook.NOTICE],
[logbook.INFO],
[logbook.DEBUG],
[logbook.TRACE],
[logbook.NOTSET],
],
)
def test_smoke(self, value):
set_log_level(value)
@pytest.mark.parametrize(
["value", "expected"], [[None, LookupError], ["unexpected", LookupError]]
)
def test_exception(self, value, expected):
with pytest.raises(expected):
set_log_level(value)