aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-07-21 14:43:53 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-07-21 14:44:14 +0200
commitfb7b201893ccc8333a9e1b8ed536faa5e3446276 (patch)
tree62306706ac3a1fa6705e106c24633fcdc2cbe9e4
parentfeed085ce82fc6dd75d0c9ed99745267e01e6c80 (diff)
parentd8918bb8d7c141ed36d0cc64c57d8481adbd48d8 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.9
-rw-r--r--build_history/blacklist.txt5
-rw-r--r--sources/pyside2/tests/QtMultimedia/audio_test.py3
-rw-r--r--sources/pyside2/tests/util/helper/__init__.py39
3 files changed, 32 insertions, 15 deletions
diff --git a/build_history/blacklist.txt b/build_history/blacklist.txt
index 4099cc094..90168464c 100644
--- a/build_history/blacklist.txt
+++ b/build_history/blacklist.txt
@@ -59,3 +59,8 @@
[QtQml::bug_451]
py2
py3
+# Crashes with Python 2 on Windows
+[QtQml::qqmlnetwork_test]
+ py2 win32
+[smart::smart_pointer]
+ win32
diff --git a/sources/pyside2/tests/QtMultimedia/audio_test.py b/sources/pyside2/tests/QtMultimedia/audio_test.py
index 66db5e1ec..dff65dc5e 100644
--- a/sources/pyside2/tests/QtMultimedia/audio_test.py
+++ b/sources/pyside2/tests/QtMultimedia/audio_test.py
@@ -30,10 +30,11 @@
import unittest
+from helper import UsesQGuiApplication
from PySide2.QtCore import *
from PySide2.QtMultimedia import *
-class testAudioDevices(unittest.TestCase):
+class testAudioDevices(UsesQGuiApplication):
def testListDevices(self):
valid = False
diff --git a/sources/pyside2/tests/util/helper/__init__.py b/sources/pyside2/tests/util/helper/__init__.py
index ff7af6999..fa119c960 100644
--- a/sources/pyside2/tests/util/helper/__init__.py
+++ b/sources/pyside2/tests/util/helper/__init__.py
@@ -36,12 +36,19 @@ from random import randint
from PySide2.QtCore import QCoreApplication, QTimer
try:
- from PySide2.QtWidgets import QApplication
+ from PySide2.QtGui import QGuiApplication
except ImportError:
has_gui = False
else:
has_gui = True
+try:
+ from PySide2.QtWidgets import QApplication
+except ImportError:
+ has_widgets = False
+else:
+ has_widgets = True
+
def adjust_filename(filename, orig_mod_filename):
dirpath = os.path.dirname(os.path.abspath(orig_mod_filename))
return os.path.join(dirpath, filename)
@@ -76,11 +83,23 @@ class BasicPySlotCase(object):
else:
raise ValueError('Invalid arguments for callback')
+if has_gui:
+ class UsesQGuiApplication(unittest.TestCase):
+ '''Helper class to provide QGuiApplication instances'''
-_instance = None
-_timed_instance = None
+ def setUp(self):
+ '''Creates the QGuiApplication instance'''
-if has_gui:
+ # Simple way of making instance a singleton
+ super(UsesQGuiApplication, self).setUp()
+ self.app = QGuiApplication.instance() or QGuiApplication([])
+
+ def tearDown(self):
+ '''Deletes the reference owned by self'''
+ del self.app
+ super(UsesQGuiApplication, self).tearDown()
+
+if has_widgets:
class UsesQApplication(unittest.TestCase):
'''Helper class to provide QApplication instances'''
@@ -91,11 +110,7 @@ if has_gui:
# Simple way of making instance a singleton
super(UsesQApplication, self).setUp()
- global _instance
- if _instance is None:
- _instance = QApplication([])
-
- self.app = _instance
+ self.app = QApplication.instance() or QApplication([])
def tearDown(self):
'''Deletes the reference owned by self'''
@@ -110,11 +125,7 @@ if has_gui:
'''Setups this Application.
timeout - timeout in milisseconds'''
- global _timed_instance
- if _timed_instance is None:
- _timed_instance = QApplication([])
-
- self.app = _timed_instance
+ self.app = QApplication.instance() or QApplication([])
QTimer.singleShot(timeout, self.app.quit)
def tearDown(self):