From 3f2a18b0f2d7a1f8da9ce8038278a2cc7b108c55 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 16 Apr 2020 11:38:32 +0000 Subject: [PATCH] [FIX] core: improve warnings configuration DeprecationWarning was configured as `once` which might be why I missed some previously: `once` means the *filter* will only signal once, meaning only one DeprecationWarning gets shown per run. Even if there are 5 *completely different* warnings getting generated by the codebase. `default` should be more suitable, I think I'd originally misunderstood it as "whatever the default is for this warning" but what it *actually* means is "print once for each (module, lineno)". An alternative could be `module` which would show the warning once per module but wouldn't trigger from different warnings in the same module. --- odoo/netsvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/netsvc.py b/odoo/netsvc.py index 9025532f32f..3e387352d0d 100644 --- a/odoo/netsvc.py +++ b/odoo/netsvc.py @@ -126,7 +126,7 @@ def init_logger(): logging.setLogRecordFactory(record_factory) # enable deprecation warnings (disabled by default) - warnings.filterwarnings('once', category=DeprecationWarning) + warnings.filterwarnings('default', category=DeprecationWarning) # ignore deprecation warnings from invalid escape (there's a ton and it's # pretty likely a super low-value signal) warnings.filterwarnings('ignore', r'^invalid escape sequence \\.', category=DeprecationWarning)