fix: show deprecation warnings by default for 'wutt*' packages
This commit is contained in:
parent
58cef0c9c2
commit
35af58bfb1
1 changed files with 45 additions and 31 deletions
|
|
@ -31,6 +31,7 @@ import logging.config
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import warnings
|
||||||
|
|
||||||
import config as configuration
|
import config as configuration
|
||||||
|
|
||||||
|
|
@ -1020,6 +1021,11 @@ def make_config( # pylint: disable=too-many-arguments,too-many-positional-argum
|
||||||
|
|
||||||
:returns: The new config object.
|
:returns: The new config object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# nb. always show deprecation warnings when making config
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.filterwarnings("default", category=DeprecationWarning, module=r"^wutt")
|
||||||
|
|
||||||
# collect file paths
|
# collect file paths
|
||||||
files = get_config_paths(
|
files = get_config_paths(
|
||||||
files=files,
|
files=files,
|
||||||
|
|
@ -1035,7 +1041,9 @@ def make_config( # pylint: disable=too-many-arguments,too-many-positional-argum
|
||||||
# make config object
|
# make config object
|
||||||
if not factory:
|
if not factory:
|
||||||
factory = WuttaConfig
|
factory = WuttaConfig
|
||||||
config = factory(files, appname=appname, usedb=usedb, preferdb=preferdb, **kwargs)
|
config = factory(
|
||||||
|
files, appname=appname, usedb=usedb, preferdb=preferdb, **kwargs
|
||||||
|
)
|
||||||
|
|
||||||
# maybe extend config object
|
# maybe extend config object
|
||||||
if extend:
|
if extend:
|
||||||
|
|
@ -1056,6 +1064,12 @@ def make_config( # pylint: disable=too-many-arguments,too-many-positional-argum
|
||||||
for extension in extensions:
|
for extension in extensions:
|
||||||
extension.startup(config)
|
extension.startup(config)
|
||||||
|
|
||||||
|
# maybe show deprecation warnings from now on
|
||||||
|
if config.get_bool(
|
||||||
|
f"{config.appname}.show_deprecation_warnings", usedb=False, default=True
|
||||||
|
):
|
||||||
|
warnings.filterwarnings("default", category=DeprecationWarning, module=r"^wutt")
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue