diff options
author | Christian Tismer <tismer@stackless.com> | 2017-11-30 19:25:59 +0100 |
---|---|---|
committer | Simo Fält <simo.falt@qt.io> | 2017-12-04 11:18:08 +0000 |
commit | 4379a97592fb282c6e6acc9185a68953e7c46e3d (patch) | |
tree | f1c8b5ee5de685590a5a9d8cdd526959d03952b0 /sources/pyside2/tests/registry/util.py | |
parent | 57af6dfbd56f4f90950e84a4b4cf8d3caedae95a (diff) |
Fix signature registry on Python2 with .pyc files, part 2
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 <simo.falt@qt.io>
Diffstat (limited to 'sources/pyside2/tests/registry/util.py')
-rw-r--r-- | sources/pyside2/tests/registry/util.py | 6 |
1 files changed, 6 insertions, 0 deletions
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: |