Merge pull request #866 from j9ac9k/fix-pyside2-qt.py-tests

Fix pyside2 qt.py tests
This commit is contained in:
Ogi Moore 2019-05-22 14:16:11 -07:00 committed by GitHub
commit f422dbd9ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -100,10 +100,13 @@ def _loadUiType(uiFile):
how to make PyQt4 and pyside look the same...
http://stackoverflow.com/a/8717832
"""
import pysideuic
if QT_LIB == "PYSIDE":
import pysideuic
else:
import pyside2uic as pysideuic
import xml.etree.ElementTree as xml
#from io import StringIO
parsed = xml.parse(uiFile)
widget_class = parsed.find('widget').get('class')
form_class = parsed.find('class').text
@ -216,8 +219,12 @@ elif QT_LIB == PYSIDE2:
except ImportError as err:
QtTest = FailedImport(err)
isQObjectAlive = _isQObjectAlive
try:
import shiboken2
isQObjectAlive = shiboken2.isValid
except ImportError:
# use approximate version
isQObjectAlive = _isQObjectAlive
import PySide2
VERSION_INFO = 'PySide2 ' + PySide2.__version__ + ' Qt ' + QtCore.__version__

View File

@ -10,7 +10,6 @@ def test_isQObjectAlive():
o2 = pg.QtCore.QObject()
o2.setParent(o1)
del o1
gc.collect()
assert not pg.Qt.isQObjectAlive(o2)
@pytest.mark.skipif(pg.Qt.QT_LIB == 'PySide', reason='pysideuic does not appear to be '