mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-16 01:42:55 +00:00
Mainly because it has better support for installing the packages from different python versions. It also has better dependency resolver than Pipenv. And supports modern standard for python dependency management. This includes usage of pyproject.toml for project specific configuration instead of per tool conf files. See following links for details: https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/ https://www.python.org/dev/peps/pep-0518/
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
import logging
|
|
import logging.config
|
|
"""
|
|
This file configures logging to use in python tests.
|
|
Logs are automatically captured and shown in their
|
|
own section after all tests are executed.
|
|
|
|
To see logs for all (even successful) tests, run
|
|
pytest with the following command:
|
|
- `poetry run pytest -n8 -rA`
|
|
|
|
Other log config can be set in pytest.ini file.
|
|
You can add `log_cli = true` to it to watch
|
|
logs in real time.
|
|
|
|
To get more info about logging with pytest, see
|
|
https://docs.pytest.org/en/6.2.x/logging.html
|
|
"""
|
|
|
|
# this config is only used for default log levels,
|
|
# log format is specified in pytest.ini file
|
|
LOGGING = {
|
|
"version": 1,
|
|
"loggers": {
|
|
"root": {
|
|
"level": "INFO"
|
|
},
|
|
"root.wal_acceptor_async": {
|
|
"level": "INFO" # a lot of logs on DEBUG level
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
def getLogger(name='root') -> logging.Logger:
|
|
"""Method to get logger for tests.
|
|
|
|
Should be used to get correctly initialized logger. """
|
|
return logging.getLogger(name)
|
|
|
|
|
|
# default logger for tests
|
|
log = getLogger()
|
|
|
|
logging.config.dictConfig(LOGGING)
|