From da98dd7dbf4e82037d57e9d18a75db09e662ea44 Mon Sep 17 00:00:00 2001 From: Kernc Date: Thu, 1 Apr 2021 01:27:36 +0200 Subject: [PATCH] BUG: Fully respect PYTHONWARNINGS, when set Fixes https://github.com/pdoc3/pdoc/issues/331 --- pdoc/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pdoc/cli.py b/pdoc/cli.py index d0dd7b9a..3fcd164a 100755 --- a/pdoc/cli.py +++ b/pdoc/cli.py @@ -432,7 +432,9 @@ def main(_args=None): global args args = _args or parser.parse_args() - warnings.simplefilter("once", DeprecationWarning) + # If warnings not externally managed, show deprecation warnings + if not sys.warnoptions: + warnings.simplefilter("once", DeprecationWarning) if args.close_stdin: sys.stdin.close()