Debian Codegraph @

src/pycolmap/util/logging_test.py

raw
1 import pycolmap
2
3
4 def test_logging_level_enum():
5 assert pycolmap.logging.INFO is not None
6 assert pycolmap.logging.WARNING is not None
7 assert pycolmap.logging.ERROR is not None
8 assert pycolmap.logging.FATAL is not None
9
10
11 def test_logging_minloglevel_readwrite():
12 original = pycolmap.logging.minloglevel
13 pycolmap.logging.minloglevel = 0
14 assert pycolmap.logging.minloglevel == 0
15 pycolmap.logging.minloglevel = original
16
17
18 def test_logging_stderrthreshold_readwrite():
19 original = pycolmap.logging.stderrthreshold
20 pycolmap.logging.stderrthreshold = 2
21 assert pycolmap.logging.stderrthreshold == 2
22 pycolmap.logging.stderrthreshold = original
23
24
25 def test_logging_log_dir_readwrite():
26 original = pycolmap.logging.log_dir
27 assert isinstance(original, str)
28 pycolmap.logging.log_dir = original
29
30
31 def test_logging_logtostderr_readwrite():
32 original = pycolmap.logging.logtostderr
33 pycolmap.logging.logtostderr = True
34 assert pycolmap.logging.logtostderr is True
35 pycolmap.logging.logtostderr = original
36
37
38 def test_logging_alsologtostderr_readwrite():
39 original = pycolmap.logging.alsologtostderr
40 pycolmap.logging.alsologtostderr = True
41 assert pycolmap.logging.alsologtostderr is True
42 pycolmap.logging.alsologtostderr = original
43
44
45 def test_logging_verbose_level_readwrite():
46 original = pycolmap.logging.verbose_level
47 pycolmap.logging.verbose_level = 1
48 assert pycolmap.logging.verbose_level == 1
49 pycolmap.logging.verbose_level = original
50
51
52 def test_logging_info():
53 pycolmap.logging.info("smoke test info message")
54
55
56 def test_logging_warning():
57 pycolmap.logging.warning("smoke test warning message")
58
59
60 def test_logging_error():
61 pycolmap.logging.error("smoke test error message")
62
63
64 def test_logging_verbose():
65 pycolmap.logging.verbose(1, "smoke test verbose message")
66
67
68 def test_logging_set_log_destination(tmp_path):
69 log_dir = str(tmp_path)
70 pycolmap.logging.set_log_destination(pycolmap.logging.INFO, log_dir)