File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 2
2
import pytest
3
3
4
4
5
- def test_basics ():
5
+ def assert_logged (capsys , expected ):
6
+ captured = capsys .readouterr ()
7
+ assert expected in captured .out or expected in captured .err
8
+
9
+
10
+ def test_basics (capsys ):
6
11
dart .common .trace ("trace log" )
12
+ assert_logged (capsys , "trace log" )
13
+
7
14
dart .common .debug ("debug log" )
15
+ assert_logged (capsys , "debug log" )
16
+
8
17
dart .common .info ("info log" )
18
+ assert_logged (capsys , "info log" )
19
+
9
20
dart .common .warn ("warn log" )
21
+ assert_logged (capsys , "warn log" )
22
+
10
23
dart .common .error ("error log" )
24
+ assert_logged (capsys , "error log" )
25
+
11
26
dart .common .fatal ("fatal log" )
27
+ assert_logged (capsys , "fatal log" )
12
28
13
29
14
- def test_arguments ():
30
+ def test_arguments (capsys ):
15
31
val = 10
16
32
dart .common .info ("Log with param '{}' and '{}'" .format (1 , val ))
33
+ assert_logged (capsys , "Log with param '1' and '10'" )
17
34
18
35
19
36
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments