Merge pull request #866 from j9ac9k/fix-pyside2-qt.py-tests
Fix pyside2 qt.py tests
This commit is contained in:
commit
f422dbd9ae
@ -100,9 +100,12 @@ def _loadUiType(uiFile):
|
|||||||
how to make PyQt4 and pyside look the same...
|
how to make PyQt4 and pyside look the same...
|
||||||
http://stackoverflow.com/a/8717832
|
http://stackoverflow.com/a/8717832
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if QT_LIB == "PYSIDE":
|
||||||
import pysideuic
|
import pysideuic
|
||||||
|
else:
|
||||||
|
import pyside2uic as pysideuic
|
||||||
import xml.etree.ElementTree as xml
|
import xml.etree.ElementTree as xml
|
||||||
#from io import StringIO
|
|
||||||
|
|
||||||
parsed = xml.parse(uiFile)
|
parsed = xml.parse(uiFile)
|
||||||
widget_class = parsed.find('widget').get('class')
|
widget_class = parsed.find('widget').get('class')
|
||||||
@ -216,8 +219,12 @@ elif QT_LIB == PYSIDE2:
|
|||||||
except ImportError as err:
|
except ImportError as err:
|
||||||
QtTest = FailedImport(err)
|
QtTest = FailedImport(err)
|
||||||
|
|
||||||
|
try:
|
||||||
|
import shiboken2
|
||||||
|
isQObjectAlive = shiboken2.isValid
|
||||||
|
except ImportError:
|
||||||
|
# use approximate version
|
||||||
isQObjectAlive = _isQObjectAlive
|
isQObjectAlive = _isQObjectAlive
|
||||||
|
|
||||||
import PySide2
|
import PySide2
|
||||||
VERSION_INFO = 'PySide2 ' + PySide2.__version__ + ' Qt ' + QtCore.__version__
|
VERSION_INFO = 'PySide2 ' + PySide2.__version__ + ' Qt ' + QtCore.__version__
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ def test_isQObjectAlive():
|
|||||||
o2 = pg.QtCore.QObject()
|
o2 = pg.QtCore.QObject()
|
||||||
o2.setParent(o1)
|
o2.setParent(o1)
|
||||||
del o1
|
del o1
|
||||||
gc.collect()
|
|
||||||
assert not pg.Qt.isQObjectAlive(o2)
|
assert not pg.Qt.isQObjectAlive(o2)
|
||||||
|
|
||||||
@pytest.mark.skipif(pg.Qt.QT_LIB == 'PySide', reason='pysideuic does not appear to be '
|
@pytest.mark.skipif(pg.Qt.QT_LIB == 'PySide', reason='pysideuic does not appear to be '
|
||||||
|
Loading…
Reference in New Issue
Block a user