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

describe_output()   A

Complexity

Conditions 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
dl 0
loc 12
rs 9.4285
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_includes_the_caller_location() 0 3 1
A it_can_be_formatted_with_init() 0 5 1
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