aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/registry/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/registry/util.py')
-rw-r--r--sources/pyside2/tests/registry/util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/sources/pyside2/tests/registry/util.py b/sources/pyside2/tests/registry/util.py
index 5d0602b2a..7e048cb24 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:
@@ -85,4 +91,10 @@ def check_warnings():
return True
return False
+def warn(message, category=None, stacklevel=1):
+ """Issue a warning with the default 'RuntimeWarning'"""
+ if category is None:
+ category = UserWarning
+ warnings.warn(message, category, stacklevel)
+
# eof