/usr/lib/python3/dist-packages/colorlog/tests/test_config.py is in python3-colorlog 3.1.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | """Test using colorlog with logging.config"""
import logging
import logging.config
import os.path
import sys
import pytest
def path(filename):
"""Return an absolute path to a file in the current directory."""
return os.path.join(os.path.dirname(os.path.realpath(__file__)), filename)
def test_build_from_file(test_logger):
logging.config.fileConfig(path("test_config.ini"))
test_logger(logging.getLogger(), lambda l: ':test_config.ini' in l)
@pytest.mark.skipif(sys.version_info < (2, 7), reason="requires python2.7")
def test_build_from_dictionary(test_logger):
logging.config.dictConfig({
'version': 1,
'formatters': {
'colored': {
'()': 'colorlog.ColoredFormatter',
'format':
"%(log_color)s%(levelname)s:%(name)s:%(message)s:dict",
}
},
'handlers': {
'stream': {
'class': 'logging.StreamHandler',
'formatter': 'colored',
'level': 'DEBUG'
},
},
'loggers': {
'': {
'handlers': ['stream'],
'level': 'DEBUG',
},
},
})
test_logger(logging.getLogger(), lambda l: ':dict' in l)
|