From 4379a97592fb282c6e6acc9185a68953e7c46e3d Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Thu, 30 Nov 2017 19:25:59 +0100 Subject: Fix signature registry on Python2 with .pyc files, part 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is unfortunately another bad side effect with .pyc files. I had to make sure that not the __file__ attribute is used, but the correct filename is computed, because __file__ can refer to the .pyc file under certain circumstances. Improved error handling, more file type checks and short filenames relative to the project path added for convenience. Task-number: PYSIDE-510 Change-Id: Ia0002fdfb382b7d3681156b1aef42739eb22dcc9 Reviewed-by: Simo Fält --- sources/pyside2/tests/registry/util.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sources/pyside2/tests/registry/util.py') diff --git a/sources/pyside2/tests/registry/util.py b/sources/pyside2/tests/registry/util.py index 5d0602b2a..d873a7d66 100644 --- a/sources/pyside2/tests/registry/util.py +++ b/sources/pyside2/tests/registry/util.py @@ -72,6 +72,12 @@ def isolate_warnings(): if warn is None: delattr(mod, warn_name) +@contextmanager +def suppress_warnings(): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + yield + def check_warnings(): for name, mod in sys.modules.items(): if mod: -- cgit v1.2.3