Completed
Push — master ( 1c9460...c543d3 )
by Jace
8s
created

it_can_be_formatted_with_init()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
1
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned,singleton-comparison
2
3
import pytest
0 ignored issues
show
introduced by
Unable to import 'pytest'
Loading history...
4
5
import log
6
7
from . import demo
8
9
10
def describe_api():
11
12
    def it_has_custom_warn_function(expect):
13
        expect(log.warn) == log.warning
14
15
16
def describe_output():
17
18
    def it_includes_the_caller_location(expect, caplog):
19
        demo.foobar()
20
        expect(caplog.text) == \
21
            "demo.py                      5 ERROR    Hello, world!\n"
22
23
    @pytest.mark.last
24
    def it_can_be_formatted_with_init(expect, caplog):
25
        log.init("%(levelname)s: %(name)s: %(message)s")
26
        demo.foobar()
27
        expect(caplog.text) == "ERROR: tests.demo: Hello, world!\n"
28